web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.4 KiB

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