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 20, 2019
1 parent 85b05e5 commit e4f9369
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Expand Up @@ -21,6 +21,7 @@
},
"devDependencies": {
"@babel/core": "^7.4.5",
"@babel/helper-plugin-test-runner": "^7.0.0"
"@babel/helper-plugin-test-runner": "^7.0.0",
"core-js-pure": "^3.0.0"
}
}
@@ -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 e4f9369

Please sign in to comment.