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.

57 lines
1.8 KiB

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