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.4 - 2017-02-18
lastIndex
is not mutated #3
eslint
, tape
, semver
; use my personal shared eslint
config c4a41c3
58d7508
tape
, jscs
, nsp
, eslint
, @ljharb/eslint-config
, semver
7290076
covert
, jscs
, eslint
, semver
dabc729
eslint
a946b05
tape
, jscs
, eslint
, @ljharb/eslint-config
1744dde
lastIndex
data property. 288ad93
editorconfig-tools
, eslint
, semver
, replace
4d895c6
eslint
, tape
, semver
f387f03
node
/iojs
versions now ship with an npm
that understands ^
. 55e480f
jscs
, nsp
, eslint
, @ljharb/eslint-config
, semver
89d9528
jscs
eb222a8
io.js
v3.3
, node
v4.1
c65429c
nsp
, eslint
c60fbd8
eslint
, semver
6a62116
node
v7.5
, v4.7
e764651
io.js
v2.1
3bf326a
io.js
versions. 693d047
31eaca2
io.js
v2.2
c18c55a
travis-ci
tests on iojs
and node
v0.12; speed up builds; allow 0.8 failures. a1c237d
eslint
, @ljharb/eslint-config
aa3ea0f
eslint
, @ljharb/eslint-config
d97831d
tape
, eslint
95e6def
eslint
, nsp
3844c93
tape
, jscs
0d6dac8
2ebef9f
io.js
v3.0
ec1d2d4
a9e333e
tape
8cdcaae
281c4ef
io.js
v2.4
4d54c68
io.js
v2.3
23170f5
iojs-v1.6
4487ad0
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.