Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 8, 2024 via pnpm

is-regex 1.1.4

Is this value a JS regex? Works cross-realm/iframe, and despite ES6 @@toStringTag
Package summary
Share
0
issues
1
license
14
MIT
Package created
15 Jan 2014
Version published
6 Aug 2021
Maintainers
1
Total deps
14
Direct deps
2
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
14 Packages, Including:
call-bind@1.0.7
define-data-property@1.1.4
es-define-property@1.0.0
es-errors@1.3.0
function-bind@1.1.2
get-intrinsic@1.2.4
gopd@1.0.1
has-property-descriptors@1.0.2
has-proto@1.0.3
has-symbols@1.0.3
has-tostringtag@1.0.2
hasown@2.0.2
is-regex@1.1.4
set-function-length@1.2.2
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

2
All Dependencies CSV
β“˜ This is a list of is-regex 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
call-bind1.0.721.6 kBMIT
prod
has-tostringtag1.0.26.31 kBMIT
prod

Visualizations

Frequently Asked Questions

What does is-regex do?

The is-regex NPM package provides a utility function for validating if given value is a JavaScript regular expression. It supports cross-realm/iframe operations and can function regardless of ES6 @@toStringTag. This tool can be incredibly valuable for developers, in validating user inputs, or distinguishing regular expressions within the data in JavaScript development scenarios.

How do you use is-regex?

To use the is-regex NPM package, first install it using npm install is-regex. Then, require the package in your JavaScript file with the require function. Here's an example of how you can use is-regex:

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

// Test non-regex values
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({}));

// Test actual regex values
assert.ok(isRegex(/a/g));
assert.ok(isRegex(new RegExp('a', 'g')));

In this example, isRegex is first applied to a variety of non-regex data types; in each case the assert.notOk() function confirms that the result is false. However, when isRegex is applied to arguments that do constitute regex patterns, assert.ok() affirms that a truthy value is returned.

Where are the is-regex docs?

The is-regex package documentation is primarily available on the GitHub page: https://github.com/inspect-js/is-regex. This page provides an overview of the package, example usage, as well as a link to the NPM listing. This repository includes a description of the module, a simple usage example, and instructions for running the packaged tests. For more detailed usage scenarios, consider forking the repository and running the tests yourself.