Last active
June 7, 2017 23:13
-
-
Save hmcq6/8c4978d861e10188065d7a4109dec085 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
let searchTerms = searchBox.value.match(/\S+/g) || []; // "People's Republic" | |
$children.filter((_, { textContent }) => ( // "People's Republic of Bangladesh" | |
!searchTerms.reduce((all, term) => ( // [ "People's", "Republic" ] | |
all && textContent. | |
match(/\S+/g). // [ "People's", "Republic", "of", "Bangladesh" ] | |
reduce((any, word) => any || word.includes(term), false) // true | |
), true) // Remove from array to be hidden if all search terms have a match | |
)).hide(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment