@stryke/helpers 0.10.13 → 0.10.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/deep-clone.cjs +3 -5
  3. package/dist/deep-clone.mjs +1 -3
  4. package/dist/deep-clone.mjs.map +1 -1
  5. package/dist/deep-merge.cjs +6 -6
  6. package/dist/deep-merge.mjs +3 -3
  7. package/dist/filter-empty.cjs +2 -2
  8. package/dist/filter-empty.mjs +1 -1
  9. package/dist/flatten-object.cjs +2 -3
  10. package/dist/flatten-object.d.cts +1 -1
  11. package/dist/flatten-object.d.mts +1 -1
  12. package/dist/flatten-object.mjs +1 -2
  13. package/dist/flatten-object.mjs.map +1 -1
  14. package/dist/get-field.cjs +4 -7
  15. package/dist/get-field.mjs +2 -5
  16. package/dist/get-field.mjs.map +1 -1
  17. package/dist/is-equal.cjs +4 -4
  18. package/dist/is-equal.mjs +2 -2
  19. package/dist/set-field.cjs +4 -4
  20. package/dist/set-field.d.cts +1 -1
  21. package/dist/set-field.d.mts +1 -1
  22. package/dist/set-field.mjs +2 -2
  23. package/dist/to-deep-key.cjs +4 -4
  24. package/dist/to-deep-key.mjs +2 -2
  25. package/dist/unflatten-object.d.cts +1 -1
  26. package/dist/unflatten-object.d.mts +1 -1
  27. package/package.json +7 -118
  28. package/dist/convert/src/index.cjs +0 -5
  29. package/dist/convert/src/index.mjs +0 -7
  30. package/dist/convert/src/parse-type-definition.cjs +0 -1
  31. package/dist/convert/src/parse-type-definition.mjs +0 -3
  32. package/dist/convert/src/string-to-utf8-array.cjs +0 -5
  33. package/dist/convert/src/string-to-utf8-array.mjs +0 -6
  34. package/dist/convert/src/string-to-utf8-array.mjs.map +0 -1
  35. package/dist/convert/src/to-bool.cjs +0 -1
  36. package/dist/convert/src/to-bool.mjs +0 -3
  37. package/dist/convert/src/to-string-key.cjs +0 -15
  38. package/dist/convert/src/to-string-key.mjs +0 -15
  39. package/dist/convert/src/to-string-key.mjs.map +0 -1
  40. package/dist/convert/src/utf8-array-to-string.cjs +0 -5
  41. package/dist/convert/src/utf8-array-to-string.mjs +0 -6
  42. package/dist/convert/src/utf8-array-to-string.mjs.map +0 -1
  43. package/dist/type-checks/src/get-object-tag.cjs +0 -15
  44. package/dist/type-checks/src/get-object-tag.mjs +0 -15
  45. package/dist/type-checks/src/get-object-tag.mjs.map +0 -1
  46. package/dist/type-checks/src/index.cjs +0 -21
  47. package/dist/type-checks/src/index.mjs +0 -23
  48. package/dist/type-checks/src/is-buffer.cjs +0 -13
  49. package/dist/type-checks/src/is-buffer.mjs +0 -14
  50. package/dist/type-checks/src/is-buffer.mjs.map +0 -1
  51. package/dist/type-checks/src/is-collection.cjs +0 -1
  52. package/dist/type-checks/src/is-collection.mjs +0 -3
  53. package/dist/type-checks/src/is-deep-key.cjs +0 -29
  54. package/dist/type-checks/src/is-deep-key.mjs +0 -29
  55. package/dist/type-checks/src/is-deep-key.mjs.map +0 -1
  56. package/dist/type-checks/src/is-empty.cjs +0 -20
  57. package/dist/type-checks/src/is-empty.mjs +0 -21
  58. package/dist/type-checks/src/is-empty.mjs.map +0 -1
  59. package/dist/type-checks/src/is-function.cjs +0 -27
  60. package/dist/type-checks/src/is-function.mjs +0 -26
  61. package/dist/type-checks/src/is-function.mjs.map +0 -1
  62. package/dist/type-checks/src/is-mergeable-object.cjs +0 -14
  63. package/dist/type-checks/src/is-mergeable-object.mjs +0 -15
  64. package/dist/type-checks/src/is-mergeable-object.mjs.map +0 -1
  65. package/dist/type-checks/src/is-non-null-object.cjs +0 -16
  66. package/dist/type-checks/src/is-non-null-object.mjs +0 -17
  67. package/dist/type-checks/src/is-non-null-object.mjs.map +0 -1
  68. package/dist/type-checks/src/is-null.cjs +0 -12
  69. package/dist/type-checks/src/is-null.mjs +0 -12
  70. package/dist/type-checks/src/is-null.mjs.map +0 -1
  71. package/dist/type-checks/src/is-number.cjs +0 -18
  72. package/dist/type-checks/src/is-number.mjs +0 -18
  73. package/dist/type-checks/src/is-number.mjs.map +0 -1
  74. package/dist/type-checks/src/is-object-index.cjs +0 -20
  75. package/dist/type-checks/src/is-object-index.mjs +0 -20
  76. package/dist/type-checks/src/is-object-index.mjs.map +0 -1
  77. package/dist/type-checks/src/is-object.cjs +0 -19
  78. package/dist/type-checks/src/is-object.mjs +0 -20
  79. package/dist/type-checks/src/is-object.mjs.map +0 -1
  80. package/dist/type-checks/src/is-plain-object.cjs +0 -64
  81. package/dist/type-checks/src/is-plain-object.mjs +0 -64
  82. package/dist/type-checks/src/is-plain-object.mjs.map +0 -1
  83. package/dist/type-checks/src/is-primitive.cjs +0 -12
  84. package/dist/type-checks/src/is-primitive.mjs +0 -12
  85. package/dist/type-checks/src/is-primitive.mjs.map +0 -1
  86. package/dist/type-checks/src/is-react-element.cjs +0 -8
  87. package/dist/type-checks/src/is-react-element.mjs +0 -8
  88. package/dist/type-checks/src/is-react-element.mjs.map +0 -1
  89. package/dist/type-checks/src/is-set-string.cjs +0 -20
  90. package/dist/type-checks/src/is-set-string.mjs +0 -21
  91. package/dist/type-checks/src/is-set-string.mjs.map +0 -1
  92. package/dist/type-checks/src/is-set.cjs +0 -19
  93. package/dist/type-checks/src/is-set.mjs +0 -20
  94. package/dist/type-checks/src/is-set.mjs.map +0 -1
  95. package/dist/type-checks/src/is-string.cjs +0 -12
  96. package/dist/type-checks/src/is-string.mjs +0 -12
  97. package/dist/type-checks/src/is-string.mjs.map +0 -1
  98. package/dist/type-checks/src/is-typed-array.cjs +0 -8
  99. package/dist/type-checks/src/is-typed-array.mjs +0 -8
  100. package/dist/type-checks/src/is-typed-array.mjs.map +0 -1
  101. package/dist/type-checks/src/is-undefined.cjs +0 -8
  102. package/dist/type-checks/src/is-undefined.mjs +0 -8
  103. package/dist/type-checks/src/is-undefined.mjs.map +0 -1
  104. package/dist/type-checks/src/property-exists.cjs +0 -31
  105. package/dist/type-checks/src/property-exists.mjs +0 -31
  106. package/dist/type-checks/src/property-exists.mjs.map +0 -1
  107. package/dist/type-checks/src/type-detect.cjs +0 -15
  108. package/dist/type-checks/src/type-detect.mjs +0 -17
  109. package/dist/type-checks/src/type-detect.mjs.map +0 -1
  110. package/dist/types/src/base.d.cts +0 -7
  111. package/dist/types/src/base.d.cts.map +0 -1
  112. package/dist/types/src/base.d.mts +0 -7
  113. package/dist/types/src/base.d.mts.map +0 -1
  114. package/dist/types/src/json.d.cts +0 -27
  115. package/dist/types/src/json.d.cts.map +0 -1
  116. package/dist/types/src/json.d.mts +0 -27
  117. package/dist/types/src/json.d.mts.map +0 -1
  118. package/dist/types/src/object.d.cts +0 -124
  119. package/dist/types/src/object.d.cts.map +0 -1
  120. package/dist/types/src/object.d.mts +0 -124
  121. package/dist/types/src/object.d.mts.map +0 -1
  122. package/dist/types/src/string.d.cts +0 -5
  123. package/dist/types/src/string.d.cts.map +0 -1
  124. package/dist/types/src/string.d.mts +0 -5
  125. package/dist/types/src/string.d.mts.map +0 -1
@@ -1,16 +0,0 @@
1
- const require_is_object = require('./is-object.cjs');
2
- const require_is_set = require('./is-set.cjs');
3
-
4
- //#region ../type-checks/src/is-non-null-object.ts
5
- /**
6
- * Check if the provided value's type is `Object` and is not `null` or `undefined`
7
- *
8
- * @param value - The value to type check
9
- * @returns An indicator specifying if the value provided is of type `Object` and is not `null` or `undefined`
10
- */
11
- const isNonNullObject = (value) => {
12
- return require_is_set.isSet(value) && require_is_object.isObject(value);
13
- };
14
-
15
- //#endregion
16
- exports.isNonNullObject = isNonNullObject;
@@ -1,17 +0,0 @@
1
- import { isObject } from "./is-object.mjs";
2
- import { isSet } from "./is-set.mjs";
3
-
4
- //#region ../type-checks/src/is-non-null-object.ts
5
- /**
6
- * Check if the provided value's type is `Object` and is not `null` or `undefined`
7
- *
8
- * @param value - The value to type check
9
- * @returns An indicator specifying if the value provided is of type `Object` and is not `null` or `undefined`
10
- */
11
- const isNonNullObject = (value) => {
12
- return isSet(value) && isObject(value);
13
- };
14
-
15
- //#endregion
16
- export { isNonNullObject };
17
- //# sourceMappingURL=is-non-null-object.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-non-null-object.mjs","names":[],"sources":["../../../../type-checks/src/is-non-null-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\nimport { isObject } from \"./is-object\";\nimport { isSet } from \"./is-set\";\n\n/**\n * Check if the provided value's type is `Object` and is not `null` or `undefined`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `Object` and is not `null` or `undefined`\n */\nexport const isNonNullObject = (value: any): value is NonNullable<object> => {\n return isSet(value) && isObject(value);\n};\n"],"mappings":";;;;;;;;;;AA2BA,MAAa,mBAAmB,UAA6C;AAC3E,QAAO,MAAM,MAAM,IAAI,SAAS,MAAM"}
@@ -1,12 +0,0 @@
1
-
2
- //#region ../type-checks/src/is-null.ts
3
- const isNull = (value) => {
4
- try {
5
- return value === null;
6
- } catch {
7
- return false;
8
- }
9
- };
10
-
11
- //#endregion
12
- exports.isNull = isNull;
@@ -1,12 +0,0 @@
1
- //#region ../type-checks/src/is-null.ts
2
- const isNull = (value) => {
3
- try {
4
- return value === null;
5
- } catch {
6
- return false;
7
- }
8
- };
9
-
10
- //#endregion
11
- export { isNull };
12
- //# sourceMappingURL=is-null.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-null.mjs","names":[],"sources":["../../../../type-checks/src/is-null.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\nexport const isNull = (value: unknown): value is null => {\n try {\n return value === null;\n } catch {\n return false;\n }\n};\n"],"mappings":";AAkBA,MAAa,UAAU,UAAkC;AACvD,KAAI;AACF,SAAO,UAAU;SACX;AACN,SAAO"}
@@ -1,18 +0,0 @@
1
-
2
- //#region ../type-checks/src/is-number.ts
3
- /**
4
- * Check if the provided value's type is `number`
5
- *
6
- * @param value - The value to type check
7
- * @returns An indicator specifying if the value provided is of type `number`
8
- */
9
- const isNumber = (value) => {
10
- try {
11
- return value instanceof Number || typeof value === "number" || Number(value) === value;
12
- } catch {
13
- return false;
14
- }
15
- };
16
-
17
- //#endregion
18
- exports.isNumber = isNumber;
@@ -1,18 +0,0 @@
1
- //#region ../type-checks/src/is-number.ts
2
- /**
3
- * Check if the provided value's type is `number`
4
- *
5
- * @param value - The value to type check
6
- * @returns An indicator specifying if the value provided is of type `number`
7
- */
8
- const isNumber = (value) => {
9
- try {
10
- return value instanceof Number || typeof value === "number" || Number(value) === value;
11
- } catch {
12
- return false;
13
- }
14
- };
15
-
16
- //#endregion
17
- export { isNumber };
18
- //# sourceMappingURL=is-number.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-number.mjs","names":[],"sources":["../../../../type-checks/src/is-number.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\nimport type { AnyNumber } from \"@stryke/types/base\";\nimport { getObjectTag } from \"./get-object-tag\";\n\n/**\n * Check if the provided value's type is `number`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `number`\n */\nexport const isNumber = (value: unknown): value is number => {\n try {\n return (\n value instanceof Number ||\n typeof value === \"number\" ||\n Number(value) === value\n );\n } catch {\n return false;\n }\n};\n\n/**\n * Check if the provided value's type is `AnyNumber`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `AnyNumber`\n */\nexport function isAnyNumber(value?: any): value is AnyNumber {\n return isNumber(value) || getObjectTag(value) === \"[object Number]\";\n}\n"],"mappings":";;;;;;;AA2BA,MAAa,YAAY,UAAoC;AAC3D,KAAI;AACF,SACE,iBAAiB,UACjB,OAAO,UAAU,YACjB,OAAO,MAAM,KAAK;SAEd;AACN,SAAO"}
@@ -1,20 +0,0 @@
1
-
2
- //#region ../type-checks/src/is-object-index.ts
3
- const IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\d*)$/;
4
- /**
5
- * Checks if the given value is an object index.
6
- *
7
- * @param value - The value to check.
8
- * @returns Returns `true` if the value is an object index, otherwise `false`.
9
- */
10
- function isObjectIndex(value) {
11
- switch (typeof value) {
12
- case "number": return Number.isInteger(value) && value >= 0 && value < Number.MAX_SAFE_INTEGER;
13
- case "symbol": return false;
14
- case "string": return IS_UNSIGNED_INTEGER.test(value);
15
- default: return false;
16
- }
17
- }
18
-
19
- //#endregion
20
- exports.isObjectIndex = isObjectIndex;
@@ -1,20 +0,0 @@
1
- //#region ../type-checks/src/is-object-index.ts
2
- const IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\d*)$/;
3
- /**
4
- * Checks if the given value is an object index.
5
- *
6
- * @param value - The value to check.
7
- * @returns Returns `true` if the value is an object index, otherwise `false`.
8
- */
9
- function isObjectIndex(value) {
10
- switch (typeof value) {
11
- case "number": return Number.isInteger(value) && value >= 0 && value < Number.MAX_SAFE_INTEGER;
12
- case "symbol": return false;
13
- case "string": return IS_UNSIGNED_INTEGER.test(value);
14
- default: return false;
15
- }
16
- }
17
-
18
- //#endregion
19
- export { isObjectIndex };
20
- //# sourceMappingURL=is-object-index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-object-index.mjs","names":[],"sources":["../../../../type-checks/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"}
@@ -1,19 +0,0 @@
1
- const require_is_plain_object = require('./is-plain-object.cjs');
2
-
3
- //#region ../type-checks/src/is-object.ts
4
- /**
5
- * Check if the provided value's type is `Object`
6
- *
7
- * @param value - The value to type check
8
- * @returns An indicator specifying if the value provided is of type `Object`
9
- */
10
- const isObject = (value) => {
11
- try {
12
- return typeof value === "object" || Boolean(value) && value?.constructor === Object || require_is_plain_object.isPlainObject(value);
13
- } catch {
14
- return false;
15
- }
16
- };
17
-
18
- //#endregion
19
- exports.isObject = isObject;
@@ -1,20 +0,0 @@
1
- import { isPlainObject } from "./is-plain-object.mjs";
2
-
3
- //#region ../type-checks/src/is-object.ts
4
- /**
5
- * Check if the provided value's type is `Object`
6
- *
7
- * @param value - The value to type check
8
- * @returns An indicator specifying if the value provided is of type `Object`
9
- */
10
- const isObject = (value) => {
11
- try {
12
- return typeof value === "object" || Boolean(value) && value?.constructor === Object || isPlainObject(value);
13
- } catch {
14
- return false;
15
- }
16
- };
17
-
18
- //#endregion
19
- export { isObject };
20
- //# sourceMappingURL=is-object.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-object.mjs","names":[],"sources":["../../../../type-checks/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":";;;;;;;;;AAyEA,MAAa,YAAY,UAAoC;AAC3D,KAAI;AACF,SACE,OAAO,UAAU,YAChB,QAAQ,MAAM,IAAI,OAAO,gBAAgB,UAC1C,cAAc,MAAM;SAEhB;AACN,SAAO"}
@@ -1,64 +0,0 @@
1
- const require_get_object_tag = require('./get-object-tag.cjs');
2
-
3
- //#region ../type-checks/src/is-plain-object.ts
4
- /**
5
- * Checks if `value` is object-like. A value is object-like if it's not `null`
6
- * and has a `typeof` result of "object".
7
- *
8
- * @example
9
- * ```typescript
10
- * isObjectLike({})
11
- * // => true
12
- *
13
- * isObjectLike([1, 2, 3])
14
- * // => true
15
- *
16
- * isObjectLike(Function)
17
- * // => false
18
- *
19
- * isObjectLike(null)
20
- * // => false
21
- * ```
22
- *
23
- * @param value - The value to check.
24
- * @returns Returns `true` if `value` is object-like, else `false`.
25
- */
26
- const isObjectLike = (value) => {
27
- return typeof value === "object" && value !== null;
28
- };
29
- /**
30
- * Checks if `obj` is a plain object, that is, an object created by the `Object` constructor or one with a `[[Prototype]]` of `null`.
31
- *
32
- * @example
33
- * ```typescript
34
- * function Foo() {
35
- * this.a = 1
36
- * }
37
- *
38
- * isPlainObject(new Foo)
39
- * // => false
40
- *
41
- * isPlainObject([1, 2, 3])
42
- * // => false
43
- *
44
- * isPlainObject({ 'x': 0, 'y': 0 })
45
- * // => true
46
- *
47
- * isPlainObject(Object.create(null))
48
- * // => true
49
- * ```
50
- *
51
- * @param obj - The value to check.
52
- * @returns Returns `true` if `obj` is a plain object, else `false`.
53
- */
54
- const isPlainObject = (obj) => {
55
- if (!isObjectLike(obj) || require_get_object_tag.getObjectTag(obj) !== "[object Object]") return false;
56
- if (Object.getPrototypeOf(obj) === null) return true;
57
- let proto = obj;
58
- while (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto);
59
- return Object.getPrototypeOf(obj) === proto;
60
- };
61
-
62
- //#endregion
63
- exports.isObjectLike = isObjectLike;
64
- exports.isPlainObject = isPlainObject;
@@ -1,64 +0,0 @@
1
- import { getObjectTag } from "./get-object-tag.mjs";
2
-
3
- //#region ../type-checks/src/is-plain-object.ts
4
- /**
5
- * Checks if `value` is object-like. A value is object-like if it's not `null`
6
- * and has a `typeof` result of "object".
7
- *
8
- * @example
9
- * ```typescript
10
- * isObjectLike({})
11
- * // => true
12
- *
13
- * isObjectLike([1, 2, 3])
14
- * // => true
15
- *
16
- * isObjectLike(Function)
17
- * // => false
18
- *
19
- * isObjectLike(null)
20
- * // => false
21
- * ```
22
- *
23
- * @param value - The value to check.
24
- * @returns Returns `true` if `value` is object-like, else `false`.
25
- */
26
- const isObjectLike = (value) => {
27
- return typeof value === "object" && value !== null;
28
- };
29
- /**
30
- * Checks if `obj` is a plain object, that is, an object created by the `Object` constructor or one with a `[[Prototype]]` of `null`.
31
- *
32
- * @example
33
- * ```typescript
34
- * function Foo() {
35
- * this.a = 1
36
- * }
37
- *
38
- * isPlainObject(new Foo)
39
- * // => false
40
- *
41
- * isPlainObject([1, 2, 3])
42
- * // => false
43
- *
44
- * isPlainObject({ 'x': 0, 'y': 0 })
45
- * // => true
46
- *
47
- * isPlainObject(Object.create(null))
48
- * // => true
49
- * ```
50
- *
51
- * @param obj - The value to check.
52
- * @returns Returns `true` if `obj` is a plain object, else `false`.
53
- */
54
- const isPlainObject = (obj) => {
55
- if (!isObjectLike(obj) || getObjectTag(obj) !== "[object Object]") return false;
56
- if (Object.getPrototypeOf(obj) === null) return true;
57
- let proto = obj;
58
- while (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto);
59
- return Object.getPrototypeOf(obj) === proto;
60
- };
61
-
62
- //#endregion
63
- export { isObjectLike, isPlainObject };
64
- //# sourceMappingURL=is-plain-object.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-plain-object.mjs","names":[],"sources":["../../../../type-checks/src/is-plain-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\nimport type { PlainObject } from \"@stryke/types/base\";\nimport { getObjectTag } from \"./get-object-tag\";\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @example\n * ```typescript\n * isObjectLike({})\n * // => true\n *\n * isObjectLike([1, 2, 3])\n * // => true\n *\n * isObjectLike(Function)\n * // => false\n *\n * isObjectLike(null)\n * // => false\n * ```\n *\n * @param value - The value to check.\n * @returns Returns `true` if `value` is object-like, else `false`.\n */\nexport const isObjectLike = (value: unknown) => {\n return typeof value === \"object\" && value !== null;\n};\n\n/**\n * Checks if `obj` is a plain object, that is, an object created by the `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @example\n * ```typescript\n * function Foo() {\n * this.a = 1\n * }\n *\n * isPlainObject(new Foo)\n * // => false\n *\n * isPlainObject([1, 2, 3])\n * // => false\n *\n * isPlainObject({ 'x': 0, 'y': 0 })\n * // => true\n *\n * isPlainObject(Object.create(null))\n * // => true\n * ```\n *\n * @param obj - The value to check.\n * @returns Returns `true` if `obj` is a plain object, else `false`.\n */\nexport const isPlainObject = (obj: unknown): obj is PlainObject => {\n if (!isObjectLike(obj) || getObjectTag(obj) !== \"[object Object]\") {\n return false;\n }\n if (Object.getPrototypeOf(obj) === null) {\n return true;\n }\n let proto = obj;\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n return Object.getPrototypeOf(obj) === proto;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAa,gBAAgB,UAAmB;AAC9C,QAAO,OAAO,UAAU,YAAY,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BhD,MAAa,iBAAiB,QAAqC;AACjE,KAAI,CAAC,aAAa,IAAI,IAAI,aAAa,IAAI,KAAK,kBAC9C,QAAO;AAET,KAAI,OAAO,eAAe,IAAI,KAAK,KACjC,QAAO;CAET,IAAI,QAAQ;AACZ,QAAO,OAAO,eAAe,MAAM,KAAK,KACtC,SAAQ,OAAO,eAAe,MAAM;AAEtC,QAAO,OAAO,eAAe,IAAI,KAAK"}
@@ -1,12 +0,0 @@
1
-
2
- //#region ../type-checks/src/is-primitive.ts
3
- const isPrimitive = (value) => {
4
- try {
5
- return value === void 0 || value === null || typeof value !== "object" && typeof value !== "function";
6
- } catch {
7
- return false;
8
- }
9
- };
10
-
11
- //#endregion
12
- exports.isPrimitive = isPrimitive;
@@ -1,12 +0,0 @@
1
- //#region ../type-checks/src/is-primitive.ts
2
- const isPrimitive = (value) => {
3
- try {
4
- return value === void 0 || value === null || typeof value !== "object" && typeof value !== "function";
5
- } catch {
6
- return false;
7
- }
8
- };
9
-
10
- //#endregion
11
- export { isPrimitive };
12
- //# sourceMappingURL=is-primitive.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-primitive.mjs","names":[],"sources":["../../../../type-checks/src/is-primitive.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\nexport const isPrimitive = (value: unknown): boolean => {\n try {\n return (\n value === undefined ||\n value === null ||\n (typeof value !== \"object\" && typeof value !== \"function\")\n );\n } catch {\n return false;\n }\n};\n"],"mappings":";AAkBA,MAAa,eAAe,UAA4B;AACtD,KAAI;AACF,SACE,UAAU,UACV,UAAU,QACT,OAAO,UAAU,YAAY,OAAO,UAAU;SAE3C;AACN,SAAO"}
@@ -1,8 +0,0 @@
1
-
2
- //#region ../type-checks/src/is-react-element.ts
3
- const isReactElement = (value) => {
4
- return value.$$typeof === (typeof Symbol === "function" && Symbol.for ? Symbol.for("react.element") : 60103);
5
- };
6
-
7
- //#endregion
8
- exports.isReactElement = isReactElement;
@@ -1,8 +0,0 @@
1
- //#region ../type-checks/src/is-react-element.ts
2
- const isReactElement = (value) => {
3
- return value.$$typeof === (typeof Symbol === "function" && Symbol.for ? Symbol.for("react.element") : 60103);
4
- };
5
-
6
- //#endregion
7
- export { isReactElement };
8
- //# sourceMappingURL=is-react-element.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-react-element.mjs","names":[],"sources":["../../../../type-checks/src/is-react-element.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\nexport const isReactElement = (value: any) => {\n return (\n value.$$typeof ===\n (typeof Symbol === \"function\" && Symbol.for\n ? Symbol.for(\"react.element\")\n : 0xea_c7)\n );\n};\n"],"mappings":";AAkBA,MAAa,kBAAkB,UAAe;AAC5C,QACE,MAAM,cACL,OAAO,WAAW,cAAc,OAAO,MACpC,OAAO,IAAI,gBAAgB,GAC3B"}
@@ -1,20 +0,0 @@
1
- const require_is_string = require('./is-string.cjs');
2
- const require_is_set = require('./is-set.cjs');
3
-
4
- //#region ../type-checks/src/is-set-string.ts
5
- /**
6
- * Determine if the type is string and is not empty (length greater than zero)
7
- *
8
- * @param value - The value to type check
9
- * @returns An indicator specifying if the value provided is of type `string` and length greater than zero
10
- */
11
- const isSetString = (value) => {
12
- try {
13
- return require_is_set.isSet(value) && require_is_string.isString(value) && value.length > 0;
14
- } catch {
15
- return false;
16
- }
17
- };
18
-
19
- //#endregion
20
- exports.isSetString = isSetString;
@@ -1,21 +0,0 @@
1
- import { isString } from "./is-string.mjs";
2
- import { isSet } from "./is-set.mjs";
3
-
4
- //#region ../type-checks/src/is-set-string.ts
5
- /**
6
- * Determine if the type is string and is not empty (length greater than zero)
7
- *
8
- * @param value - The value to type check
9
- * @returns An indicator specifying if the value provided is of type `string` and length greater than zero
10
- */
11
- const isSetString = (value) => {
12
- try {
13
- return isSet(value) && isString(value) && value.length > 0;
14
- } catch {
15
- return false;
16
- }
17
- };
18
-
19
- //#endregion
20
- export { isSetString };
21
- //# sourceMappingURL=is-set-string.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-set-string.mjs","names":[],"sources":["../../../../type-checks/src/is-set-string.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\nimport { isSet } from \"./is-set\";\nimport { isString } from \"./is-string\";\n\n/**\n * Determine if the type is string and is not empty (length greater than zero)\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `string` and length greater than zero\n */\nexport const isSetString = (value: unknown): value is NonNullable<string> => {\n try {\n return isSet(value) && isString(value) && value.length > 0;\n } catch {\n return false;\n }\n};\n"],"mappings":";;;;;;;;;;AA2BA,MAAa,eAAe,UAAiD;AAC3E,KAAI;AACF,SAAO,MAAM,MAAM,IAAI,SAAS,MAAM,IAAI,MAAM,SAAS;SACnD;AACN,SAAO"}
@@ -1,19 +0,0 @@
1
- const require_is_empty = require('./is-empty.cjs');
2
-
3
- //#region ../type-checks/src/is-set.ts
4
- /**
5
- * The inverse of the `isEmpty` function
6
- *
7
- * @param value - The value to type check
8
- * @returns An indicator specifying if the value provided is **NOT** of type `null` or `undefined`
9
- */
10
- const isSet = (value) => {
11
- try {
12
- return !require_is_empty.isEmpty(value);
13
- } catch {
14
- return false;
15
- }
16
- };
17
-
18
- //#endregion
19
- exports.isSet = isSet;
@@ -1,20 +0,0 @@
1
- import { isEmpty } from "./is-empty.mjs";
2
-
3
- //#region ../type-checks/src/is-set.ts
4
- /**
5
- * The inverse of the `isEmpty` function
6
- *
7
- * @param value - The value to type check
8
- * @returns An indicator specifying if the value provided is **NOT** of type `null` or `undefined`
9
- */
10
- const isSet = (value) => {
11
- try {
12
- return !isEmpty(value);
13
- } catch {
14
- return false;
15
- }
16
- };
17
-
18
- //#endregion
19
- export { isSet };
20
- //# sourceMappingURL=is-set.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-set.mjs","names":[],"sources":["../../../../type-checks/src/is-set.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\nimport { isEmpty } from \"./is-empty\";\n\n/**\n * The inverse of the `isEmpty` function\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is **NOT** of type `null` or `undefined`\n */\nexport const isSet = (value: unknown): value is NonNullable<unknown> => {\n try {\n return !isEmpty(value);\n } catch {\n return false;\n }\n};\n"],"mappings":";;;;;;;;;AA0BA,MAAa,SAAS,UAAkD;AACtE,KAAI;AACF,SAAO,CAAC,QAAQ,MAAM;SAChB;AACN,SAAO"}
@@ -1,12 +0,0 @@
1
-
2
- //#region ../type-checks/src/is-string.ts
3
- const isString = (value) => {
4
- try {
5
- return typeof value === "string";
6
- } catch {
7
- return false;
8
- }
9
- };
10
-
11
- //#endregion
12
- exports.isString = isString;
@@ -1,12 +0,0 @@
1
- //#region ../type-checks/src/is-string.ts
2
- const isString = (value) => {
3
- try {
4
- return typeof value === "string";
5
- } catch {
6
- return false;
7
- }
8
- };
9
-
10
- //#endregion
11
- export { isString };
12
- //# sourceMappingURL=is-string.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-string.mjs","names":[],"sources":["../../../../type-checks/src/is-string.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\nexport const isString = (value: unknown): value is string => {\n try {\n return typeof value === \"string\";\n } catch {\n return false;\n }\n};\n"],"mappings":";AAkBA,MAAa,YAAY,UAAoC;AAC3D,KAAI;AACF,SAAO,OAAO,UAAU;SAClB;AACN,SAAO"}
@@ -1,8 +0,0 @@
1
-
2
- //#region ../type-checks/src/is-typed-array.ts
3
- function isTypedArray(obj) {
4
- return obj instanceof Uint8Array || obj instanceof Uint8ClampedArray || obj instanceof Uint16Array || obj instanceof Uint32Array || obj instanceof BigUint64Array || obj instanceof Int8Array || obj instanceof Int16Array || obj instanceof Int32Array || obj instanceof BigInt64Array || obj instanceof Float32Array || obj instanceof Float64Array;
5
- }
6
-
7
- //#endregion
8
- exports.isTypedArray = isTypedArray;
@@ -1,8 +0,0 @@
1
- //#region ../type-checks/src/is-typed-array.ts
2
- function isTypedArray(obj) {
3
- return obj instanceof Uint8Array || obj instanceof Uint8ClampedArray || obj instanceof Uint16Array || obj instanceof Uint32Array || obj instanceof BigUint64Array || obj instanceof Int8Array || obj instanceof Int16Array || obj instanceof Int32Array || obj instanceof BigInt64Array || obj instanceof Float32Array || obj instanceof Float64Array;
4
- }
5
-
6
- //#endregion
7
- export { isTypedArray };
8
- //# sourceMappingURL=is-typed-array.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-typed-array.mjs","names":[],"sources":["../../../../type-checks/src/is-typed-array.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\nexport function isTypedArray(\n obj: any\n): obj is\n | Uint8Array\n | Uint8ClampedArray\n | Uint16Array\n | Uint32Array\n | BigUint64Array\n | Int8Array\n | Int16Array\n | Int32Array\n | BigInt64Array\n | Float32Array\n | Float64Array {\n return (\n obj instanceof Uint8Array ||\n obj instanceof Uint8ClampedArray ||\n obj instanceof Uint16Array ||\n obj instanceof Uint32Array ||\n obj instanceof BigUint64Array ||\n obj instanceof Int8Array ||\n obj instanceof Int16Array ||\n obj instanceof Int32Array ||\n obj instanceof BigInt64Array ||\n obj instanceof Float32Array ||\n obj instanceof Float64Array\n );\n}\n"],"mappings":";AAkBA,SAAgB,aACd,KAYe;AACf,QACE,eAAe,cACf,eAAe,qBACf,eAAe,eACf,eAAe,eACf,eAAe,kBACf,eAAe,aACf,eAAe,cACf,eAAe,cACf,eAAe,iBACf,eAAe,gBACf,eAAe"}
@@ -1,8 +0,0 @@
1
-
2
- //#region ../type-checks/src/is-undefined.ts
3
- const isUndefined = (value) => {
4
- return value === void 0;
5
- };
6
-
7
- //#endregion
8
- exports.isUndefined = isUndefined;
@@ -1,8 +0,0 @@
1
- //#region ../type-checks/src/is-undefined.ts
2
- const isUndefined = (value) => {
3
- return value === void 0;
4
- };
5
-
6
- //#endregion
7
- export { isUndefined };
8
- //# sourceMappingURL=is-undefined.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-undefined.mjs","names":[],"sources":["../../../../type-checks/src/is-undefined.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\nexport const isUndefined = (value: unknown): value is undefined => {\n return value === undefined;\n};\n"],"mappings":";AAkBA,MAAa,eAAe,UAAuC;AACjE,QAAO,UAAU"}
@@ -1,31 +0,0 @@
1
- const require_is_object = require('./is-object.cjs');
2
-
3
- //#region ../type-checks/src/property-exists.ts
4
- /**
5
- * Check if the provided object has the provided property
6
- *
7
- * @param object - The object to check
8
- * @param propertyKey - The property to check
9
- * @returns An indicator specifying if the object has the provided property
10
- */
11
- const propertyExists = (object, propertyKey) => {
12
- try {
13
- return require_is_object.isObject(object) && propertyKey in object;
14
- } catch {
15
- return false;
16
- }
17
- };
18
- /**
19
- * Check if the provided object has the provided property and if it's safe to merge
20
- *
21
- * @param object - The object to check
22
- * @param propertyKey - The property to check
23
- * @returns An indicator specifying if the object has the provided property and if it's safe to merge
24
- */
25
- const propertyUnsafe = (object, propertyKey) => {
26
- return propertyExists(object, propertyKey) && !(Object.hasOwnProperty.call(object, propertyKey) && Object.propertyIsEnumerable.call(object, propertyKey));
27
- };
28
-
29
- //#endregion
30
- exports.propertyExists = propertyExists;
31
- exports.propertyUnsafe = propertyUnsafe;