Skip to content

Instantly share code, notes, and snippets.

@triblondon
Created January 10, 2018 20:49
Show Gist options
  • Save triblondon/06264253749bef68bc9a8278780c648c to your computer and use it in GitHub Desktop.
Save triblondon/06264253749bef68bc9a8278780c648c to your computer and use it in GitHub Desktop.
reformat sigs
list.split('\n')
.map(line => {
const parts = line.match(/<a href=['"](.*?)['"]>(.*?)\s+(\S+)\s*<\/a>/);
if (parts) {
return {givenName: parts[2], familyName: parts[3], url: parts[1]};
} else {
console.log(line);
}
})
.sort((a,b) => a['familyName'] > b['familyName'] ? 1 : -1)
.filter(x => !!x)
.map(obj => `<li><a href="${obj.url}">${obj.givenName} ${obj.familyName}</a></li>`)
.join('\n')
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment