toKey.cjs 811 B

123456789101112131415161718192021222324
  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 isSymbol_js_1 = __importDefault(require("./isSymbol.cjs"));
  8. /** Used as references for various `Number` constants. */
  9. const INFINITY = 1 / 0;
  10. /**
  11. * Converts `value` to a string key if it's not a string or symbol.
  12. *
  13. * @private
  14. * @param {*} value The value to inspect.
  15. * @returns {string|symbol} Returns the key.
  16. */
  17. function toKey(value) {
  18. if (typeof value === "string" || (0, isSymbol_js_1.default)(value)) {
  19. return value;
  20. }
  21. const result = `${value}`;
  22. return result === "0" && 1 / value === -INFINITY ? "-0" : result;
  23. }
  24. exports.default = toKey;