npm.io
3.1.0 • Published 4 years ago

is-regexp

Licence
MIT
Version
3.1.0
Deps
0
Size
3 kB
Vulns
0
Weekly
0
Stars
26
Better alternativeUse v instanceof RegExp, or if cross-realm, use Object.prototype.toString.call(v) === "[object RegExp]"Consider using a lighter alternative

is-regexp

Check if a value is a regular expression

Install

$ npm install is-regexp

Usage

import isRegexp from 'is-regexp';

isRegexp('unicorn');
//=> false

isRegexp(/unicorn/);
//=> true

isRegexp(new RegExp('unicorn'));
//=> true

FAQ

Why not just use instanceof instead of this package?
  • is - Type check values

Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Keywords