Created
January 30, 2018 17:25
-
-
Save briankung/ecc601f02aa51bd419cc6a013e3f905e to your computer and use it in GitHub Desktop.
Removes redundant craigslist results from a search based on title
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
const reducer = (resultTitles, result) => { | |
let title = result.querySelector('.result-title').innerText | |
resultTitles.includes(title) ? result.remove() : resultTitles.push(title) | |
return resultTitles | |
} | |
[...document.querySelectorAll('li.result-row')].reduce(reducer, []) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment