'index' and 'input' property on return type for custom token pattern
See original GitHub issueThe return type for a CustomPatternMatcherFunc
is a RegExpExecArray
(or null), which is defined as:
interface RegExpExecArray extends Array<string> {
index: number;
input: string;
}
The documentation doesn’t mention these properties.
Are they actually required? If so, what should their value be? If not, perhaps RegExpMatchArray
would be a better return type? It’s the same as RegExpExecArray
but with the index
and input
properties marked as optional:
interface RegExpMatchArray extends Array<string> {
index?: number;
input?: string;
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (14 by maintainers)
Top Results From Across the Web
Tokenizer - Marked Documentation
A function that returns the index of the next potential start of the custom token. The index can be the result of a...
Read more >Add custom analyzers to string fields - Azure Cognitive Search
Configure text tokenizers and character filters to perform text analysis on strings during indexing and queries.
Read more >Property 'fName' comes from an index signature, so it must be ...
We are talking about a template-driven form validation. You need to validate something, let's say to ensure that a field is required (call ......
Read more >Array of tokenized documents for text analysis - MathWorks
The custom tokens have token type "custom" . View the token details. The column Type contains the token types. tdetails = tokenDetails(documents).
Read more >Rule-based matching · spaCy Usage Documentation
If spaCy's tokenization doesn't match the tokens defined in a pattern, the pattern ... IS_SUBSET, Attribute value (for MORPH or custom list attributes)...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think I’ve read about this “NOOP” pattern in a performance guide related to BlueBird promises library…
It can hurt maintainability by adding complexity and even some partially duplicated code, also sometimes there are performance regressions in V8 that need to be tracked down and mitigated. e.g: https://github.com/SAP/chevrotain/issues/942
Basically Performance is a feature and every feature has its costs 😦
Whoops I completely missed your other comment…
That’s really clever… Does it hurt maintainability like at all? The performance benefits are obviously worth it but I’m curious how such a thing impacts debugging/maintenance.