Skip to content

Conversation

@fb55
Copy link
Member

@fb55 fb55 commented May 15, 2021

Fixes #1867

@sehrgut
Copy link

sehrgut commented May 17, 2021

This should also iterate over comment nodes. It doesn't appear to do that.

@fb55
Copy link
Member Author

fb55 commented May 17, 2021

@sehrgut This PR removes the restrictions for all set types. With this PR, you can iterate over a Cheerio<number> without issue. TS doesn't like this (yet), but this runs in pure JS:

$([1,2,3,4,5]).filter((_,n)=>n%2).toArray()
//=> [1,3,5]

@fb55 fb55 enabled auto-merge (squash) May 17, 2021 12:31
@fb55 fb55 merged commit fb8d31e into main May 17, 2021
@fb55 fb55 deleted the fix/filter branch May 17, 2021 12:34
@sehrgut
Copy link

sehrgut commented May 17, 2021

Ah! I see that now. I think I assumed from the new imports list import { Node, Element, Text, isText } from 'domhandler'; that those would be the only ones picked up by AcceptedFilters<T>. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

textNode not passed into .filter method

3 participants