-
-
Notifications
You must be signed in to change notification settings - Fork 689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use native RegExp Match indices #1652
Merged
Merged
Conversation
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
aslakhellesoy
added
⚡ enhancement
Request for new functionality
library: cucumber-expressions
language: javascript
🧷 pinned
Tells Stalebot not to close this issue
labels
Jul 10, 2021
aslakhellesoy
changed the title
Use native RegExp#indices
Use native RegExp Match indices
Jul 10, 2021
Update: I added the polyfill so we don't have to wait until 2023/2024 to merge this. |
aslakhellesoy
requested review from
mattwynne,
aurelien-reeves,
charlierudolph and
davidjgoss
July 12, 2021 08:30
aurelien-reeves
approved these changes
Jul 12, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
👍 If we're using the polyfill let's edit the text in the PR to reflect that and remove the warnings. |
PR text updated |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Use RegExpExecArray#indices to get the position of capture groups.
Details
This PR removes the dependency on the becke-ch--regex--s0-0-v1--base--pl--lib library and uses
RegExpExecArray#indices
instead.RegExp Match Indices were introduced in v8 v9.0.259. The first Node.js release to use a v8 newer than that is 16.4.0.
Since we cannot drop support for Node.js < 16.4.0 until 2023/2024, the implementation currently uses a polyfill.
Motivation and Context
The main motivation for this change is to stop depending on http://www--s0-v1.becke.ch/tool/becke-ch--regex--s0-v1/becke-ch--regex--s0-0-v1--homepage--pl--client/, which seems to be a liability to depend on because it doesn't seem to have a public Git repo, except for this fork.
I would also expect this to be slightly more performant since it's based on a native implementation, but I doubt it will be significant for end users.
Also see #300
How Has This Been Tested?
The tests pass on Node v16.4.2, but I doubt it will pass on Node < 16.4.0 as explained above.
Types of changes
Checklist: