caoge c760052ff9 机车状态修改 | il y a 8 mois | |
---|---|---|
.. | ||
.github | il y a 8 mois | |
test | il y a 8 mois | |
.eslintrc | il y a 8 mois | |
CHANGELOG.md | il y a 8 mois | |
LICENSE | il y a 8 mois | |
README.md | il y a 8 mois | |
index.js | il y a 8 mois | |
package.json | il y a 8 mois |
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