Add convenience matcher functions to dom package #138
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We have discussed similar APIs before, to make the common use cases easier.
createAnySelectorMatcher
mimics the signature of existing matcher creators, but works on any selector type we support. For tools that try to maximise interoperability, matching a selector of any supported type should be easy; checking the type and using the right matcher is a task we can do for the user.matchSelector
wraps the this to make the common use case easy, hiding the generator and returning an array instead. Until they get advanced needs, a user should not have to care about async generators and curried functions to anchor a selector. Especially so as our highlighter messes up the matcher when used before the latter is finished (see issue TextQuoteSelector selector yielding an infinite number of matches #112).Note this code depends on (and already includes the commits of) #136 and #137.
When trying to run
yarn start
, I get an error about missing imports, so probably I messed something up still..