Bakhtina Sofya b84cb877be 1st comm | hai 1 mes | |
---|---|---|
.. | ||
.github | hai 1 mes | |
test | hai 1 mes | |
.eslintrc | hai 1 mes | |
.nycrc | hai 1 mes | |
CHANGELOG.md | hai 1 mes | |
LICENSE | hai 1 mes | |
README.md | hai 1 mes | |
index.js | hai 1 mes | |
package.json | hai 1 mes |
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