Fix typo in wrapRegExp helper (#9726)
This commit is contained in:
parent
ab41cb2cda
commit
bf94bb9d43
@ -1870,7 +1870,7 @@ helpers.wrapRegExp = helper("7.2.6")`
|
|||||||
// but in that case Babel doesn't add the wrapper anyway.
|
// but in that case Babel doesn't add the wrapper anyway.
|
||||||
|
|
||||||
var g = _groups.get(re);
|
var g = _groups.get(re);
|
||||||
return Object.keys(groups).reduce(function(groups, name) {
|
return Object.keys(g).reduce(function(groups, name) {
|
||||||
groups[name] = result[g[name]];
|
groups[name] = result[g[name]];
|
||||||
return groups;
|
return groups;
|
||||||
}, Object.create(null));
|
}, Object.create(null));
|
||||||
|
|||||||
10
packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-9722.js
vendored
Normal file
10
packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-9722.js
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
const regex1 = /(?<alpha>\w+):(?<bravo>\d+)/;
|
||||||
|
const regex2 = /(?<alpha>\w+):(?<bravo>[a-z]+):(?<charlie>\w+)/;
|
||||||
|
|
||||||
|
const result = regex2.exec("foo:abc:bar");
|
||||||
|
|
||||||
|
expect(result.groups).toEqual({
|
||||||
|
alpha: "foo",
|
||||||
|
bravo: "abc",
|
||||||
|
charlie: "bar",
|
||||||
|
});
|
||||||
Loading…
x
Reference in New Issue
Block a user