_baseGetTag.js 792 B

12345678910111213141516171819202122232425262728
  1. var Symbol = require('./_Symbol'),
  2. getRawTag = require('./_getRawTag'),
  3. objectToString = require('./_objectToString');
  4. /** `Object#toString` result references. */
  5. var nullTag = '[object Null]',
  6. undefinedTag = '[object Undefined]';
  7. /** Built-in value references. */
  8. var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  9. /**
  10. * The base implementation of `getTag` without fallbacks for buggy environments.
  11. *
  12. * @private
  13. * @param {*} value The value to query.
  14. * @returns {string} Returns the `toStringTag`.
  15. */
  16. function baseGetTag(value) {
  17. if (value == null) {
  18. return value === undefined ? undefinedTag : nullTag;
  19. }
  20. return (symToStringTag && symToStringTag in Object(value))
  21. ? getRawTag(value)
  22. : objectToString(value);
  23. }
  24. module.exports = baseGetTag;