is-regexp
Check whether a variable is a regular expression
Last updated 12 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install is-regexp 
SYNC missed versions from official npm registry.

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?

Related

  • 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.

Current Tags

  • 3.1.0                                ...           latest (4 years ago)

5 Versions

  • 3.1.0                                ...           4 years ago
  • 3.0.0                                ...           5 years ago
  • 2.1.0                                ...           7 years ago
  • 2.0.0                                ...           8 years ago
  • 1.0.0                                ...           12 years ago
Maintainers (1)
Downloads
Today 6
This Week 79
This Month 278
Last Day 55
Last Week 142
Last Month 372
Dependencies (0)
None
Dev Dependencies (1)

Copyright 2013 - present © cnpmjs.org | Home |