{"version":3,"file":"is-object.mjs","names":[],"sources":["../src/is-object.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\n/* eslint-disable ts/no-unsafe-function-type */\n/* eslint-disable ts/no-unsafe-call */\n\nimport type { NativeClass } from \"@stryke/types/base\";\nimport { isPlainObject } from \"./is-plain-object\";\n\n// Prepare\nconst isClassRegex = /^class\\s|^function\\s+[A-Z]/;\nconst isConventionalClassRegex = /^function\\s+[A-Z]/;\nconst isNativeClassRegex = /^class\\s/;\n\n/** Is ES6+ class */\nexport function isNativeClass(value?: any): value is NativeClass {\n  // NOTE TO DEVELOPER: If any of this changes, isClass must also be updated\n  return (\n    typeof value === \"function\" && isNativeClassRegex.test(value.toString())\n  );\n}\n\n/**\n * Check if the provided value's type is a conventional class\n *\n * @remarks\n * Is Conventional Class\n * Looks for function with capital first letter MyClass\n * First letter is the 9th character\n * If changed, isClass must also be updated\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is a conventional class\n */\nexport function isConventionalClass(value?: any): value is Function {\n  return (\n    typeof value === \"function\" &&\n    isConventionalClassRegex.test(value.toString())\n  );\n}\n\n/**\n * Check if the provided value's type is `Object`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `Object`\n */\nexport function isClass(value?: any): value is Function | NativeClass; // only guarantee of truth type, not of validity\nexport function isClass(value?: any): boolean {\n  return typeof value === \"function\" && isClassRegex.test(value.toString());\n}\n\n/**\n * Check if the provided value's type is `Object`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `Object`\n */\nexport const isObject = (value: unknown): value is object => {\n  try {\n    return (\n      typeof value === \"object\" ||\n      (Boolean(value) && value?.constructor === Object) ||\n      isPlainObject(value)\n    );\n  } catch {\n    return false;\n  }\n};\n"],"mappings":";;;AAyBA,MAAM,eAAe;AACrB,MAAM,2BAA2B;AACjC,MAAM,qBAAqB;;AAG3B,SAAgB,cAAc,OAAmC;AAE/D,QACE,OAAO,UAAU,cAAc,mBAAmB,KAAK,MAAM,UAAU,CAAC;;;;;;;;;;;;;;AAgB5E,SAAgB,oBAAoB,OAAgC;AAClE,QACE,OAAO,UAAU,cACjB,yBAAyB,KAAK,MAAM,UAAU,CAAC;;AAWnD,SAAgB,QAAQ,OAAsB;AAC5C,QAAO,OAAO,UAAU,cAAc,aAAa,KAAK,MAAM,UAAU,CAAC;;;;;;;;AAS3E,MAAa,YAAY,UAAoC;AAC3D,KAAI;AACF,SACE,OAAO,UAAU,YAChB,QAAQ,MAAM,IAAI,OAAO,gBAAgB,UAC1C,cAAc,MAAM;SAEhB;AACN,SAAO"}