Make a parser that tests a token with a given predicate and returns the token value unchanged.
This overload uses a type guard predicate to narrow the token/value type on success.
Use token instead if you want to transform the value.
Use filter for testing a match from another parser instead of a token directly.
A test condition/predicate.
A token at the parser position.
Data object (tokens and options).
Parser position in the tokens array (points at the same token).
Make a parser that tests a token with a given predicate and returns the token value unchanged.
This overload uses a type guard predicate to narrow the token/value type on success.
Use token instead if you want to transform the value.
Use filter for testing a match from another parser instead of a token directly.