{"version":3,"file":"is-object-index.mjs","names":[],"sources":["../src/is-object-index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n                       🗲 Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website:                  https://stormsoftware.com\n Repository:               https://github.com/storm-software/stryke\n Documentation:            https://docs.stormsoftware.com/projects/stryke\n Contact:                  https://stormsoftware.com/contact\n\n SPDX-License-Identifier:  Apache-2.0\n\n ------------------------------------------------------------------- */\n\nconst IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if the given value is an object index.\n *\n * @param value - The value to check.\n * @returns Returns `true` if the value is an object index, otherwise `false`.\n */\nexport function isObjectIndex(\n  value: PropertyKey\n): value is string | number | symbol {\n  switch (typeof value) {\n    case \"number\": {\n      return (\n        Number.isInteger(value) && value >= 0 && value < Number.MAX_SAFE_INTEGER\n      );\n    }\n    case \"symbol\": {\n      return false;\n    }\n    case \"string\": {\n      return IS_UNSIGNED_INTEGER.test(value);\n    }\n    case \"bigint\":\n    case \"boolean\":\n    case \"function\":\n    case \"object\":\n    case \"undefined\":\n    default: {\n      return false;\n    }\n  }\n}\n"],"mappings":";AAkBA,MAAM,sBAAsB;;;;;;;AAQ5B,SAAgB,cACd,OACmC;AACnC,SAAQ,OAAO,OAAf;EACE,KAAK,SACH,QACE,OAAO,UAAU,MAAM,IAAI,SAAS,KAAK,QAAQ,OAAO;EAG5D,KAAK,SACH,QAAO;EAET,KAAK,SACH,QAAO,oBAAoB,KAAK,MAAM;EAOxC,QACE,QAAO"}