Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix capturing group for matchAll (#10136)
* fix capturing group for matchAll * update test case * add core-js/features/string/match-all to test
- Loading branch information
1 parent
f160522
commit 6a9d253
Showing
5 changed files
with
40 additions
and
5 deletions.
There are no files selected for viewing
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
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
16 changes: 16 additions & 0 deletions
16
...gin-transform-named-capturing-groups-regex/test/fixtures/runtime/match-all-corejs/exec.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require('core-js/features/string/match-all.js'); | ||
|
||
const string = "Favorite GitHub repos: tc39/ecma262 v8/v8.dev"; | ||
const regex = /\b(?<owner>[a-z0-9]+)\/(?<repo>[a-z0-9\.]+)\b/g; | ||
|
||
const matches = string.matchAll(regex); | ||
|
||
expect(matches.next().value.groups).toEqual({ | ||
owner: "tc39", | ||
repo: "ecma262", | ||
}); | ||
|
||
expect(matches.next().value.groups).toEqual({ | ||
owner: "v8", | ||
repo: "v8.dev", | ||
}); |
14 changes: 14 additions & 0 deletions
14
...bel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/match-all/exec.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const string = "Favorite GitHub repos: tc39/ecma262 v8/v8.dev"; | ||
const regex = /\b(?<owner>[a-z0-9]+)\/(?<repo>[a-z0-9\.]+)\b/g; | ||
|
||
const matches = string.matchAll(regex); | ||
|
||
expect(matches.next().value.groups).toEqual({ | ||
owner: "tc39", | ||
repo: "ecma262", | ||
}); | ||
|
||
expect(matches.next().value.groups).toEqual({ | ||
owner: "v8", | ||
repo: "v8.dev", | ||
}); |
3 changes: 3 additions & 0 deletions
3
...lugin-transform-named-capturing-groups-regex/test/fixtures/runtime/match-all/options.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"minNodeVersion": "12.0.0" | ||
} |