Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
test/ | 25-Sep-2023 | - | 105 | 90 | ||
.editorconfig | D | 24-Sep-2023 | 286 | 21 | 16 | |
.eslintignore | D | 24-Sep-2023 | 10 | 2 | 1 | |
.eslintrc | D | 24-Sep-2023 | 221 | 20 | 16 | |
.nycrc | D | 24-Sep-2023 | 159 | 11 | 10 | |
CHANGELOG.md | D | 24-Sep-2023 | 19.4 KiB | 198 | 157 | |
LICENSE | D | 24-Sep-2023 | 1.1 KiB | 21 | 16 | |
README.md | D | 24-Sep-2023 | 1.8 KiB | 53 | 43 | |
index.js | D | 24-Sep-2023 | 1.4 KiB | 59 | 47 | |
package.json | D | 24-Sep-2023 | 2.2 KiB | 87 | 86 |
README.md
1# is-regex <sup>[![Version Badge][2]][1]</sup> 2 3[![github actions][actions-image]][actions-url] 4[![coverage][codecov-image]][codecov-url] 5[![dependency status][5]][6] 6[![dev dependency status][7]][8] 7[![License][license-image]][license-url] 8[![Downloads][downloads-image]][downloads-url] 9 10[![npm badge][11]][1] 11 12Is this value a JS regex? 13This module works cross-realm/iframe, and despite ES6 @@toStringTag. 14 15## Example 16 17```js 18var isRegex = require('is-regex'); 19var assert = require('assert'); 20 21assert.notOk(isRegex(undefined)); 22assert.notOk(isRegex(null)); 23assert.notOk(isRegex(false)); 24assert.notOk(isRegex(true)); 25assert.notOk(isRegex(42)); 26assert.notOk(isRegex('foo')); 27assert.notOk(isRegex(function () {})); 28assert.notOk(isRegex([])); 29assert.notOk(isRegex({})); 30 31assert.ok(isRegex(/a/g)); 32assert.ok(isRegex(new RegExp('a', 'g'))); 33``` 34 35## Tests 36Simply clone the repo, `npm install`, and run `npm test` 37 38[1]: https://npmjs.org/package/is-regex 39[2]: https://versionbadg.es/inspect-js/is-regex.svg 40[5]: https://david-dm.org/inspect-js/is-regex.svg 41[6]: https://david-dm.org/inspect-js/is-regex 42[7]: https://david-dm.org/inspect-js/is-regex/dev-status.svg 43[8]: https://david-dm.org/inspect-js/is-regex#info=devDependencies 44[11]: https://nodei.co/npm/is-regex.png?downloads=true&stars=true 45[license-image]: https://img.shields.io/npm/l/is-regex.svg 46[license-url]: LICENSE 47[downloads-image]: https://img.shields.io/npm/dm/is-regex.svg 48[downloads-url]: https://npm-stat.com/charts.html?package=is-regex 49[codecov-image]: https://codecov.io/gh/inspect-js/is-regex/branch/main/graphs/badge.svg 50[codecov-url]: https://app.codecov.io/gh/inspect-js/is-regex/ 51[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-regex 52[actions-url]: https://github.com/inspect-js/is-regex/actions 53