basant307/AI_Governance_Project
048
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## Example16 17```js18var 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## Tests36Simply clone the repo, `npm install`, and run `npm test`37 38[1]: https://npmjs.org/package/is-regex39[2]: https://versionbadg.es/inspect-js/is-regex.svg40[5]: https://david-dm.org/inspect-js/is-regex.svg41[6]: https://david-dm.org/inspect-js/is-regex42[7]: https://david-dm.org/inspect-js/is-regex/dev-status.svg43[8]: https://david-dm.org/inspect-js/is-regex#info=devDependencies44[11]: https://nodei.co/npm/is-regex.png?downloads=true&stars=true45[license-image]: https://img.shields.io/npm/l/is-regex.svg46[license-url]: LICENSE47[downloads-image]: https://img.shields.io/npm/dm/is-regex.svg48[downloads-url]: https://npm-stat.com/charts.html?package=is-regex49[codecov-image]: https://codecov.io/gh/inspect-js/is-regex/branch/main/graphs/badge.svg50[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-regex52[actions-url]: https://github.com/inspect-js/is-regex/actions53 