Created
September 17, 2018 16:14
-
-
Save crutchcorn/e4a5f7e1d7c160d2a5d856ab66bfd657 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
recursive = (el) => el.children && el.children.length !== 0 ? Array.from(el.children).reduce((prev, child) => [...prev, ...recursive(child)], Array.from(el.children)) : [el]; | |
$$('.js-hotel-result').forEach(hotelEl => { | |
const isBad = recursive(hotelEl).reduce((prev, el) => prev || !!(/^ ?[2-9][0-9](?:\.[0-9]+)? miles.*/).exec(el.innerText), false); | |
if (isBad) { | |
hotelEl.parentNode.removeChild(hotelEl); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A more readible version of this would be: