caoge c760052ff9 机车状态修改 | hai 8 meses | |
---|---|---|
.. | ||
.github | hai 8 meses | |
test | hai 8 meses | |
.eslintrc | hai 8 meses | |
CHANGELOG.md | hai 8 meses | |
LICENSE | hai 8 meses | |
README.md | hai 8 meses | |
index.js | hai 8 meses | |
package.json | hai 8 meses |
Give a regex, get a robust predicate function that tests it against a string. This will work even if RegExp.prototype
is altered later.
npm install --save safe-regex-test
var regexTester = require('safe-regex-test');
var assert = require('assert');
var tester = regexTester('a');
assert.ok(tester('a'));
assert.notOk(tester('b'));
Simply clone the repo, npm install
, and run npm test