Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
.jscs.json | D | 12-May-2024 | 4 KiB | 177 | 114 | |
.npmignore | D | 12-May-2024 | 97 | 16 | 13 | |
.travis.yml | D | 12-May-2024 | 4.7 KiB | 166 | 165 | |
CHANGELOG.md | D | 12-May-2024 | 1.1 KiB | 28 | 23 | |
LICENSE | D | 12-May-2024 | 1.1 KiB | 21 | 16 | |
Makefile | D | 12-May-2024 | 3.7 KiB | 62 | 40 | |
README.md | D | 12-May-2024 | 1.6 KiB | 55 | 43 | |
index.js | D | 12-May-2024 | 918 | 40 | 33 | |
package.json | D | 12-May-2024 | 1.8 KiB | 77 | 76 | |
test.js | D | 12-May-2024 | 1.8 KiB | 59 | 51 |
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