• Home
Name Date Size #Lines LOC

..--

.jscs.jsonD12-May-20244 KiB177114

.npmignoreD12-May-202497 1613

.travis.ymlD12-May-20244.7 KiB166165

CHANGELOG.mdD12-May-20241.1 KiB2823

LICENSED12-May-20241.1 KiB2116

MakefileD12-May-20243.7 KiB6240

README.mdD12-May-20241.6 KiB5543

index.jsD12-May-2024918 4033

package.jsonD12-May-20241.8 KiB7776

test.jsD12-May-20241.8 KiB5951

README.md

1#is-regex <sup>[![Version Badge][2]][1]</sup>
2
3[![Build Status][3]][4]
4[![dependency status][5]][6]
5[![dev dependency status][7]][8]
6[![License][license-image]][license-url]
7[![Downloads][downloads-image]][downloads-url]
8
9[![npm badge][11]][1]
10
11[![browser support][9]][10]
12
13Is this value a JS regex?
14This module works cross-realm/iframe, and despite ES6 @@toStringTag.
15
16## Example
17
18```js
19var isRegex = require('is-regex');
20var assert = require('assert');
21
22assert.notOk(isRegex(undefined));
23assert.notOk(isRegex(null));
24assert.notOk(isRegex(false));
25assert.notOk(isRegex(true));
26assert.notOk(isRegex(42));
27assert.notOk(isRegex('foo'));
28assert.notOk(isRegex(function () {}));
29assert.notOk(isRegex([]));
30assert.notOk(isRegex({}));
31
32assert.ok(isRegex(/a/g));
33assert.ok(isRegex(new RegExp('a', 'g')));
34```
35
36## Tests
37Simply clone the repo, `npm install`, and run `npm test`
38
39[1]: https://npmjs.org/package/is-regex
40[2]: http://versionbadg.es/ljharb/is-regex.svg
41[3]: https://travis-ci.org/ljharb/is-regex.svg
42[4]: https://travis-ci.org/ljharb/is-regex
43[5]: https://david-dm.org/ljharb/is-regex.svg
44[6]: https://david-dm.org/ljharb/is-regex
45[7]: https://david-dm.org/ljharb/is-regex/dev-status.svg
46[8]: https://david-dm.org/ljharb/is-regex#info=devDependencies
47[9]: https://ci.testling.com/ljharb/is-regex.png
48[10]: https://ci.testling.com/ljharb/is-regex
49[11]: https://nodei.co/npm/is-regex.png?downloads=true&stars=true
50[license-image]: http://img.shields.io/npm/l/is-regex.svg
51[license-url]: LICENSE
52[downloads-image]: http://img.shields.io/npm/dm/is-regex.svg
53[downloads-url]: http://npm-stat.com/charts.html?package=is-regex
54
55