Bakhtina Sofya b84cb877be 1st comm | há 2 semanas atrás | |
---|---|---|
.. | ||
.github | há 2 semanas atrás | |
test | há 2 semanas atrás | |
.eslintrc | há 2 semanas atrás | |
.nycrc | há 2 semanas atrás | |
CHANGELOG.md | há 2 semanas atrás | |
LICENSE | há 2 semanas atrás | |
README.md | há 2 semanas atrás | |
index.js | há 2 semanas atrás | |
package.json | há 2 semanas atrás |
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