Created
April 3, 2019 10:57
-
-
Save ahmadawais/bb3d72332269670a32c4b06de028f10f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get GitHub usernames that contributed in a file. | |
* | |
* @author AhmadAwais <https://github.com/AhmadAwais> | |
* @since 2019-04-03 | |
*/ | |
const usernames = []; | |
// Select the right data of anchor links and loop over it. | |
document.querySelectorAll('.link-gray-dark.no-underline').forEach(lnk => { | |
// Username is the string's array's fourth item. | |
usernames.push(lnk.href.split('/')[3]); | |
}); | |
// Make a list like username, username without quotes. | |
const ctrbs = usernames.join(', '); | |
// Add `, ` at the start and `, ahmadawais` at the end. | |
const final = ', '.concat(ctrbs).concat(', ahmadawais'); | |
// Copy to your clipboard. | |
copy(final); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment