Created
April 9, 2019 09:43
-
-
Save AndrewStanton94/d91292814129c4646ebdf22276be29a6 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
processTable = (table) => { | |
rows = table.querySelector('tbody').children; | |
rows = [...rows].map((r) => { | |
const link = r.children[0].children[0]; // Get the hyperlink from cell 1 | |
let {href, innerText} = link; | |
innerText = innerText.split(' ').filter((x) => !(['Professor', 'Dr', 'Mr', 'Mrs', 'Miss', 'Ms'].includes(x))).join(' '); | |
return {href, innerText} | |
}) | |
output = rows.map(({href, innerText}) => `${innerText} ${href}`).join('\n'); | |
console.log(output); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment