Zhouyiping 5a7c95461a first commit 2 өдөр өмнө
..
test 5a7c95461a first commit 2 өдөр өмнө
.editorconfig 5a7c95461a first commit 2 өдөр өмнө
.eslintignore 5a7c95461a first commit 2 өдөр өмнө
.eslintrc 5a7c95461a first commit 2 өдөр өмнө
.nycrc 5a7c95461a first commit 2 өдөр өмнө
CHANGELOG.md 5a7c95461a first commit 2 өдөр өмнө
LICENSE 5a7c95461a first commit 2 өдөр өмнө
README.md 5a7c95461a first commit 2 өдөр өмнө
index.js 5a7c95461a first commit 2 өдөр өмнө
package.json 5a7c95461a first commit 2 өдөр өмнө

README.md

is-regex Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

Is this value a JS regex? This module works cross-realm/iframe, and despite ES6 @@toStringTag.

Example

var isRegex = require('is-regex');
var assert = require('assert');

assert.notOk(isRegex(undefined));
assert.notOk(isRegex(null));
assert.notOk(isRegex(false));
assert.notOk(isRegex(true));
assert.notOk(isRegex(42));
assert.notOk(isRegex('foo'));
assert.notOk(isRegex(function () {}));
assert.notOk(isRegex([]));
assert.notOk(isRegex({}));

assert.ok(isRegex(/a/g));
assert.ok(isRegex(new RegExp('a', 'g')));

Tests

Simply clone the repo, npm install, and run npm test