is-regex <sup>Version Badge</sup>

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

is-regex - Installation

To install is-regex via this registry, you'll need to install via the --registry parameter with your package manager.

n

NPM

npm install is-regex --registry https://js.registry.sudovanilla.org

Learn more about the --registry parameter.

Yarn

yarn config set registry https://js.registry.sudovanilla.org
yarn install is-regex

Learn more about the config option.

PNPM

pnpm install is-regex --registry https://js.registry.sudovanilla.org

Learn more about the --registry parameter.

Bun Logo

Bun

bun install is-regex --registry https://js.registry.sudovanilla.org

Learn more about the --registry parameter.

Learn more about setting this up in your bunfig.toml configuration.


For Deno, add the following to your .npmrc file in your directory:

registry="https://js.registry.sudovanilla.org"

Then run the deno install command.

is-regex - Download

Download Tarball (v1.2.1)

Integrity sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==
SHASUM 76d70a3ed10ef9be48eb577887d74205bf0cad22
Tarball https://js.registry.sudovanilla.org/is-regex/-/is-regex-1.2.1.tgz