Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Is this value a JS regex? Works cross-realm/iframe, and despite ES6 @@toStringTag
The is-regex npm package is a utility for checking if a value is a regular expression. It is primarily used to determine whether a given value is an instance of a RegExp object.
Check if a value is a RegExp
This feature allows you to verify if a value is a regular expression by returning a boolean result. It's useful when you need to ensure that a variable contains a valid RegExp object before performing operations that are specific to regular expressions.
const isRegex = require('is-regex');
console.log(isRegex(/abc/)); // true
console.log(isRegex('abc')); // false
Similar to is-regex, is-regexp is a package that checks if a value is a regular expression. It provides a similar functionality but may have different implementation details or dependencies.
This is a Lodash module to check if a value is classified as a RegExp object. While it offers similar functionality, it comes from the Lodash library which is a broader utility toolkit and might be preferred in projects already using Lodash.
Is this value a JS regex? This module works cross-realm/iframe, and despite ES6 @@toStringTag.
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')));
Simply clone the repo, npm install
, and run npm test
v1.0.1 - 2015-01-28
1f1733a
npm run lint
51ea70f
042c8c7
366d619
6a32e4f
tape
, jscs
f1b9462
jscs
1bff23f
tape
, jscs
c22ea2e
tape
, jscs
b0479db
1a6e347
090a4ea
tape
7d76129
9a90b03
bfbc7f5
13ad511
cda1945
de96c99
2cb6567
a56ae74
ffe47f7
FAQs
Is this value a JS regex? Works cross-realm/iframe, and despite ES6 @@toStringTag
The npm package is-regex receives a total of 30,916,389 weekly downloads. As such, is-regex popularity was classified as popular.
We found that is-regex demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.