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.

24 lines
596 B

  1. 'use strict';
  2. var strValue = String.prototype.valueOf;
  3. var tryStringObject = function tryStringObject(value) {
  4. try {
  5. strValue.call(value);
  6. return true;
  7. } catch (e) {
  8. return false;
  9. }
  10. };
  11. var toStr = Object.prototype.toString;
  12. var strClass = '[object String]';
  13. var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
  14. module.exports = function isString(value) {
  15. if (typeof value === 'string') {
  16. return true;
  17. }
  18. if (typeof value !== 'object') {
  19. return false;
  20. }
  21. return hasToStringTag ? tryStringObject(value) : toStr.call(value) === strClass;
  22. };