isSymbol.cjs 843 B

12345678910111213141516171819202122232425262728
  1. "use strict";
  2. // @ts-nocheck
  3. var __importDefault = (this && this.__importDefault) || function (mod) {
  4. return (mod && mod.__esModule) ? mod : { "default": mod };
  5. };
  6. Object.defineProperty(exports, "__esModule", { value: true });
  7. const getTag_js_1 = __importDefault(require("./getTag.cjs"));
  8. /**
  9. * Checks if `value` is classified as a `Symbol` primitive or object.
  10. *
  11. * @since 4.0.0
  12. * @category Lang
  13. * @param {*} value The value to check.
  14. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  15. * @example
  16. *
  17. * isSymbol(Symbol.iterator)
  18. * // => true
  19. *
  20. * isSymbol('abc')
  21. * // => false
  22. */
  23. function isSymbol(value) {
  24. const type = typeof value;
  25. return (type === "symbol" ||
  26. (type === "object" && value != null && (0, getTag_js_1.default)(value) === "[object Symbol]"));
  27. }
  28. exports.default = isSymbol;