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 10, 2019
1 parent 85b05e5 commit c727a1c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 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",
});

0 comments on commit c727a1c

Please sign in to comment.