inspect-js/is-regex


Is this value a JS regex?

License: MIT

Language: Makefile


#is-regex Version Badge

Build Status dependency status dev dependency status License Downloads

npm badge

browser support

Is this value a JS regex? This module works cross-realm/iframe, and despite ES6 @@toStringTag.

Example

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')));

Tests

Simply clone the repo, npm install, and run npm test

Project Statistics

Sourcerank 13
Repository Size 70.3 KB
Stars 9
Forks 4
Watchers 2
Open issues 3
Dependencies 8
Contributors 2
Tags 6
Created
Last updated
Last pushed

Top Contributors See all

Jordan Harband Greenkeeper

Packages Referencing this Repo

is-regex
Is this value a JS regex? Works cross-realm/iframe, and despite ES6 @@toStringTag
Latest release 1.0.4 - Updated - 9 stars
org.webjars.npm:is-regex
WebJar for is-regex
Latest release 1.0.4 - Updated - 9 stars

Recent Tags See all

v1.0.4 February 18, 2017
v1.0.3 January 30, 2015
v1.0.2 January 29, 2015
v1.0.1 January 28, 2015
v1.0.0 May 19, 2014
v0.0.0 January 15, 2014

Something wrong with this page? Make a suggestion

Last synced: 2019-08-10 17:14:15 UTC

Login to resync this repository