Skip to content

Commit

Permalink
add core-js/features/string/match-all to test
Browse files Browse the repository at this point in the history
  • Loading branch information
tanhauhau committed Jul 11, 2019
1 parent 85b05e5 commit 1dacdd5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
Expand Up @@ -14,6 +14,7 @@
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-named-capturing-groups-regex",
"bugs": "https://github.com/babel/babel/issues",
"dependencies": {
"core-js-pure": "^3.0.0",
"regexp-tree": "^0.1.6"
},
"peerDependencies": {
Expand Down
@@ -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",
});
4 changes: 2 additions & 2 deletions packages/babel-runtime-corejs2/package.json
Expand Up @@ -9,10 +9,10 @@
"repository": "https://github.com/babel/babel/tree/master/packages/babel-runtime-corejs2",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"dependencies": {
"core-js": "^2.6.5",
"regenerator-runtime": "^0.13.2"
},
"devDependencies": {
"@babel/helpers": "^7.5.4"
"@babel/helpers": "^7.5.4",
"core-js": "^2.6.5"
}
}

0 comments on commit 1dacdd5

Please sign in to comment.