@stryke/zod 0.1.0 → 0.2.0

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 (71) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/index.cjs +4 -2
  3. package/dist/index.d.cts +4 -4
  4. package/dist/index.d.mts +4 -4
  5. package/dist/index.mjs +4 -3
  6. package/dist/is-zod-type-B-jL80F-.mjs +197 -0
  7. package/dist/is-zod-type-B-jL80F-.mjs.map +1 -0
  8. package/dist/is-zod-type-CDtbhw8L.d.mts +30 -0
  9. package/dist/is-zod-type-CDtbhw8L.d.mts.map +1 -0
  10. package/dist/is-zod-type-RGE-O0aK.cjs +214 -0
  11. package/dist/is-zod-type-x0dit7lA.d.cts +30 -0
  12. package/dist/is-zod-type-x0dit7lA.d.cts.map +1 -0
  13. package/dist/is-zod-type.cjs +4 -34
  14. package/dist/is-zod-type.d.cts +2 -30
  15. package/dist/is-zod-type.d.mts +3 -30
  16. package/dist/is-zod-type.mjs +2 -33
  17. package/dist/schema-B6usLZOz.mjs +44 -0
  18. package/dist/schema-B6usLZOz.mjs.map +1 -0
  19. package/dist/schema-DQPkBDAQ.d.mts +32 -0
  20. package/dist/schema-DQPkBDAQ.d.mts.map +1 -0
  21. package/dist/schema-s8jVY_-l.d.cts +32 -0
  22. package/dist/schema-s8jVY_-l.d.cts.map +1 -0
  23. package/dist/schema-wGX9lE9h.cjs +82 -0
  24. package/dist/schema.cjs +3 -32
  25. package/dist/schema.d.cts +2 -22
  26. package/dist/schema.d.mts +3 -22
  27. package/dist/schema.mjs +2 -31
  28. package/dist/types-4nTrnOUu.d.cts +20 -0
  29. package/dist/types-4nTrnOUu.d.cts.map +1 -0
  30. package/dist/types-UlEWkGXF.d.mts +20 -0
  31. package/dist/types-UlEWkGXF.d.mts.map +1 -0
  32. package/dist/types.d.cts +2 -20
  33. package/dist/types.d.mts +2 -20
  34. package/dist/types.mjs +0 -1
  35. package/package.json +50 -8
  36. package/dist/_virtual/rolldown_runtime.cjs +0 -29
  37. package/dist/is-zod-type.d.cts.map +0 -1
  38. package/dist/is-zod-type.d.mts.map +0 -1
  39. package/dist/is-zod-type.mjs.map +0 -1
  40. package/dist/schema.d.cts.map +0 -1
  41. package/dist/schema.d.mts.map +0 -1
  42. package/dist/schema.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/is-empty.cjs +0 -20
  47. package/dist/type-checks/src/is-empty.mjs +0 -21
  48. package/dist/type-checks/src/is-empty.mjs.map +0 -1
  49. package/dist/type-checks/src/is-non-null-object.cjs +0 -16
  50. package/dist/type-checks/src/is-non-null-object.mjs +0 -17
  51. package/dist/type-checks/src/is-non-null-object.mjs.map +0 -1
  52. package/dist/type-checks/src/is-null.cjs +0 -12
  53. package/dist/type-checks/src/is-null.mjs +0 -12
  54. package/dist/type-checks/src/is-null.mjs.map +0 -1
  55. package/dist/type-checks/src/is-object.cjs +0 -19
  56. package/dist/type-checks/src/is-object.mjs +0 -20
  57. package/dist/type-checks/src/is-object.mjs.map +0 -1
  58. package/dist/type-checks/src/is-plain-object.cjs +0 -63
  59. package/dist/type-checks/src/is-plain-object.mjs +0 -64
  60. package/dist/type-checks/src/is-plain-object.mjs.map +0 -1
  61. package/dist/type-checks/src/is-set-object.cjs +0 -19
  62. package/dist/type-checks/src/is-set-object.mjs +0 -20
  63. package/dist/type-checks/src/is-set-object.mjs.map +0 -1
  64. package/dist/type-checks/src/is-set.cjs +0 -19
  65. package/dist/type-checks/src/is-set.mjs +0 -20
  66. package/dist/type-checks/src/is-set.mjs.map +0 -1
  67. package/dist/type-checks/src/is-undefined.cjs +0 -8
  68. package/dist/type-checks/src/is-undefined.mjs +0 -8
  69. package/dist/type-checks/src/is-undefined.mjs.map +0 -1
  70. package/dist/types.d.cts.map +0 -1
  71. package/dist/types.d.mts.map +0 -1
@@ -1,15 +0,0 @@
1
-
2
- //#region ../type-checks/src/get-object-tag.ts
3
- /**
4
- * Gets the `toStringTag` of `obj`.
5
- *
6
- * @param value - The obj to query.
7
- * @returns Returns the `toStringTag`.
8
- */
9
- const getObjectTag = (value) => {
10
- if (value == null) return value === void 0 ? "[object Undefined]" : "[object Null]";
11
- return Object.prototype.toString.call(value);
12
- };
13
-
14
- //#endregion
15
- exports.getObjectTag = getObjectTag;
@@ -1,15 +0,0 @@
1
- //#region ../type-checks/src/get-object-tag.ts
2
- /**
3
- * Gets the `toStringTag` of `obj`.
4
- *
5
- * @param value - The obj to query.
6
- * @returns Returns the `toStringTag`.
7
- */
8
- const getObjectTag = (value) => {
9
- if (value == null) return value === void 0 ? "[object Undefined]" : "[object Null]";
10
- return Object.prototype.toString.call(value);
11
- };
12
-
13
- //#endregion
14
- export { getObjectTag };
15
- //# sourceMappingURL=get-object-tag.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-object-tag.mjs","names":[],"sources":["../../../../type-checks/src/get-object-tag.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/**\n * Gets the `toStringTag` of `obj`.\n *\n * @param value - The obj to query.\n * @returns Returns the `toStringTag`.\n */\nexport const getObjectTag = (value: unknown): string => {\n if (value == null) {\n return value === undefined ? \"[object Undefined]\" : \"[object Null]\";\n }\n return Object.prototype.toString.call(value);\n};\n"],"mappings":";;;;;;;AAwBA,MAAa,gBAAgB,UAA2B;AACtD,KAAI,SAAS,KACX,QAAO,UAAU,SAAY,uBAAuB;AAEtD,QAAO,OAAO,UAAU,SAAS,KAAK,MAAM"}
@@ -1,20 +0,0 @@
1
- const require_is_null = require('./is-null.cjs');
2
- const require_is_undefined = require('./is-undefined.cjs');
3
-
4
- //#region ../type-checks/src/is-empty.ts
5
- /**
6
- * Check if the provided value's type is `null` or `undefined`
7
- *
8
- * @param value - The value to type check
9
- * @returns An indicator specifying if the value provided is of type `null` or `undefined`
10
- */
11
- const isEmpty = (value) => {
12
- try {
13
- return require_is_undefined.isUndefined(value) || require_is_null.isNull(value);
14
- } catch {
15
- return false;
16
- }
17
- };
18
-
19
- //#endregion
20
- exports.isEmpty = isEmpty;
@@ -1,21 +0,0 @@
1
- import { isNull } from "./is-null.mjs";
2
- import { isUndefined } from "./is-undefined.mjs";
3
-
4
- //#region ../type-checks/src/is-empty.ts
5
- /**
6
- * Check if the provided value's type is `null` or `undefined`
7
- *
8
- * @param value - The value to type check
9
- * @returns An indicator specifying if the value provided is of type `null` or `undefined`
10
- */
11
- const isEmpty = (value) => {
12
- try {
13
- return isUndefined(value) || isNull(value);
14
- } catch {
15
- return false;
16
- }
17
- };
18
-
19
- //#endregion
20
- export { isEmpty };
21
- //# sourceMappingURL=is-empty.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-empty.mjs","names":[],"sources":["../../../../type-checks/src/is-empty.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 { isDate } from \"./is-date\";\nimport { isFunction } from \"./is-function\";\nimport { isNull } from \"./is-null\";\nimport { isNumber } from \"./is-number\";\nimport { isSymbol } from \"./is-symbol\";\nimport { isUndefined } from \"./is-undefined\";\n\n/**\n * Check if the provided value's type is `null` or `undefined`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `null` or `undefined`\n */\nexport const isEmpty = (value: unknown) => {\n try {\n return isUndefined(value) || isNull(value);\n } catch {\n return false;\n }\n};\n\nexport const isEmptyAnything = (value: any) => {\n if (value === true || value === false) return true;\n if (value === null || value === undefined) return true;\n if (isNumber(value)) return value === 0;\n if (isDate(value)) return Number.isNaN(value.getTime());\n if (isFunction(value)) return false;\n if (isSymbol(value)) return false;\n const { length } = value;\n if (isNumber(length)) return length === 0;\n const { size } = value;\n if (isNumber(size)) return size === 0;\n const keys = Object.keys(value).length;\n\n return keys === 0;\n};\n"],"mappings":";;;;;;;;;;AA+BA,MAAa,WAAW,UAAmB;AACzC,KAAI;AACF,SAAO,YAAY,MAAM,IAAI,OAAO,MAAM;SACpC;AACN,SAAO"}
@@ -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,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,63 +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 = (obj) => {
27
- return typeof obj === "object" && obj !== 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.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 = (obj) => {
27
- return typeof obj === "object" && obj !== 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 { 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 = (obj: unknown) => {\n return typeof obj === \"object\" && obj !== 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,QAAiB;AAC5C,QAAO,OAAO,QAAQ,YAAY,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4B5C,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,19 +0,0 @@
1
- const require_is_non_null_object = require('./is-non-null-object.cjs');
2
-
3
- //#region ../type-checks/src/is-set-object.ts
4
- /**
5
- * Check if the provided value's type is an object with some fields set
6
- *
7
- * @param value - The value to type check
8
- * @returns An indicator specifying if the value provided is an object with some fields se
9
- */
10
- const isSetObject = (value) => {
11
- try {
12
- return require_is_non_null_object.isNonNullObject(value) && Object.keys(value).length > 0;
13
- } catch {
14
- return false;
15
- }
16
- };
17
-
18
- //#endregion
19
- exports.isSetObject = isSetObject;
@@ -1,20 +0,0 @@
1
- import { isNonNullObject } from "./is-non-null-object.mjs";
2
-
3
- //#region ../type-checks/src/is-set-object.ts
4
- /**
5
- * Check if the provided value's type is an object with some fields set
6
- *
7
- * @param value - The value to type check
8
- * @returns An indicator specifying if the value provided is an object with some fields se
9
- */
10
- const isSetObject = (value) => {
11
- try {
12
- return isNonNullObject(value) && Object.keys(value).length > 0;
13
- } catch {
14
- return false;
15
- }
16
- };
17
-
18
- //#endregion
19
- export { isSetObject };
20
- //# sourceMappingURL=is-set-object.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-set-object.mjs","names":[],"sources":["../../../../type-checks/src/is-set-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 { isNonNullObject } from \"./is-non-null-object\";\n\n/**\n * Check if the provided value's type is an object with some fields set\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is an object with some fields se\n */\nexport const isSetObject = (value: unknown): value is NonNullable<object> => {\n try {\n return isNonNullObject(value) && Object.keys(value).length > 0;\n } catch {\n return false;\n }\n};\n"],"mappings":";;;;;;;;;AA0BA,MAAa,eAAe,UAAiD;AAC3E,KAAI;AACF,SAAO,gBAAgB,MAAM,IAAI,OAAO,KAAK,MAAM,CAAC,SAAS;SACvD;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,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 +0,0 @@
1
- {"version":3,"file":"types.d.cts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;;KAqBY,OAAA,GAAU,EAAA,CAAG,aAAa,EAAA,CAAG;KAE7B,WAAA;AAFZ;AAEA;AAqBA;UAAiB,WAAA;QACT"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;;KAqBY,OAAA,GAAU,EAAA,CAAG,aAAa,EAAA,CAAG;KAE7B,WAAA;AAFZ;AAEA;AAqBA;UAAiB,WAAA;QACT"}