@stryke/type-checks 0.5.18 → 0.5.20
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.
- package/CHANGELOG.md +12 -0
- package/dist/get-object-tag.cjs +15 -1
- package/dist/get-object-tag.mjs +14 -1
- package/dist/get-object-tag.mjs.map +1 -1
- package/dist/index.cjs +100 -1
- package/dist/index.mjs +45 -1
- package/dist/is-array-like.cjs +17 -1
- package/dist/is-array-like.mjs +17 -1
- package/dist/is-array-like.mjs.map +1 -1
- package/dist/is-async-iterable.cjs +16 -1
- package/dist/is-async-iterable.mjs +16 -1
- package/dist/is-async-iterable.mjs.map +1 -1
- package/dist/is-bigint.cjs +22 -1
- package/dist/is-bigint.mjs +22 -1
- package/dist/is-bigint.mjs.map +1 -1
- package/dist/is-boolean.cjs +18 -1
- package/dist/is-boolean.mjs +17 -1
- package/dist/is-boolean.mjs.map +1 -1
- package/dist/is-buffer.cjs +13 -1
- package/dist/is-buffer.mjs +11 -1
- package/dist/is-buffer.mjs.map +1 -1
- package/dist/is-collection.cjs +22 -1
- package/dist/is-collection.mjs +22 -1
- package/dist/is-collection.mjs.map +1 -1
- package/dist/is-date.cjs +23 -1
- package/dist/is-date.mjs +23 -1
- package/dist/is-date.mjs.map +1 -1
- package/dist/is-deep-key.cjs +52 -1
- package/dist/is-deep-key.mjs +50 -1
- package/dist/is-deep-key.mjs.map +1 -1
- package/dist/is-empty-object.cjs +33 -1
- package/dist/is-empty-object.mjs +32 -1
- package/dist/is-empty-object.mjs.map +1 -1
- package/dist/is-empty-string.cjs +20 -1
- package/dist/is-empty-string.mjs +20 -1
- package/dist/is-empty-string.mjs.map +1 -1
- package/dist/is-empty.cjs +38 -1
- package/dist/is-empty.mjs +37 -1
- package/dist/is-empty.mjs.map +1 -1
- package/dist/is-equal.cjs +19 -1
- package/dist/is-equal.mjs +18 -1
- package/dist/is-equal.mjs.map +1 -1
- package/dist/is-error.cjs +29 -1
- package/dist/is-error.mjs +29 -1
- package/dist/is-error.mjs.map +1 -1
- package/dist/is-file-result.cjs +21 -1
- package/dist/is-file-result.mjs +21 -1
- package/dist/is-file-result.mjs.map +1 -1
- package/dist/is-float.cjs +13 -1
- package/dist/is-float.mjs +13 -1
- package/dist/is-float.mjs.map +1 -1
- package/dist/is-function.cjs +27 -1
- package/dist/is-function.mjs +25 -1
- package/dist/is-function.mjs.map +1 -1
- package/dist/is-integer.cjs +14 -1
- package/dist/is-integer.mjs +14 -1
- package/dist/is-integer.mjs.map +1 -1
- package/dist/is-mergeable-object.cjs +14 -1
- package/dist/is-mergeable-object.mjs +14 -1
- package/dist/is-mergeable-object.mjs.map +1 -1
- package/dist/is-non-null-object.cjs +16 -1
- package/dist/is-non-null-object.mjs +16 -1
- package/dist/is-non-null-object.mjs.map +1 -1
- package/dist/is-not-empty.cjs +21 -1
- package/dist/is-not-empty.mjs +21 -1
- package/dist/is-not-empty.mjs.map +1 -1
- package/dist/is-null.cjs +12 -1
- package/dist/is-null.mjs +11 -1
- package/dist/is-null.mjs.map +1 -1
- package/dist/is-number.cjs +29 -1
- package/dist/is-number.mjs +28 -1
- package/dist/is-number.mjs.map +1 -1
- package/dist/is-object-index.cjs +19 -1
- package/dist/is-object-index.mjs +18 -1
- package/dist/is-object-index.mjs.map +1 -1
- package/dist/is-object.cjs +47 -1
- package/dist/is-object.mjs +44 -1
- package/dist/is-object.mjs.map +1 -1
- package/dist/is-plain-object.cjs +64 -1
- package/dist/is-plain-object.mjs +63 -1
- package/dist/is-plain-object.mjs.map +1 -1
- package/dist/is-primitive.cjs +12 -1
- package/dist/is-primitive.mjs +11 -1
- package/dist/is-primitive.mjs.map +1 -1
- package/dist/is-promise.cjs +27 -1
- package/dist/is-promise.mjs +26 -1
- package/dist/is-promise.mjs.map +1 -1
- package/dist/is-react-element.cjs +8 -1
- package/dist/is-react-element.mjs +7 -1
- package/dist/is-react-element.mjs.map +1 -1
- package/dist/is-ref.cjs +18 -1
- package/dist/is-ref.mjs +17 -1
- package/dist/is-ref.mjs.map +1 -1
- package/dist/is-regexp.cjs +23 -1
- package/dist/is-regexp.mjs +23 -1
- package/dist/is-regexp.mjs.map +1 -1
- package/dist/is-select-option.cjs +19 -1
- package/dist/is-select-option.mjs +19 -1
- package/dist/is-select-option.mjs.map +1 -1
- package/dist/is-set-array.cjs +15 -1
- package/dist/is-set-array.mjs +15 -1
- package/dist/is-set-array.mjs.map +1 -1
- package/dist/is-set-object.cjs +19 -1
- package/dist/is-set-object.mjs +19 -1
- package/dist/is-set-object.mjs.map +1 -1
- package/dist/is-set-string.cjs +20 -1
- package/dist/is-set-string.mjs +20 -1
- package/dist/is-set-string.mjs.map +1 -1
- package/dist/is-set.cjs +19 -1
- package/dist/is-set.mjs +19 -1
- package/dist/is-set.mjs.map +1 -1
- package/dist/is-string.cjs +12 -1
- package/dist/is-string.mjs +11 -1
- package/dist/is-string.mjs.map +1 -1
- package/dist/is-symbol.cjs +12 -1
- package/dist/is-symbol.mjs +11 -1
- package/dist/is-symbol.mjs.map +1 -1
- package/dist/is-typed-array.cjs +8 -1
- package/dist/is-typed-array.mjs +7 -1
- package/dist/is-typed-array.mjs.map +1 -1
- package/dist/is-typed.cjs +20 -1
- package/dist/is-typed.mjs +20 -1
- package/dist/is-typed.mjs.map +1 -1
- package/dist/is-undefined.cjs +8 -1
- package/dist/is-undefined.mjs +7 -1
- package/dist/is-undefined.mjs.map +1 -1
- package/dist/is-url.cjs +16 -1
- package/dist/is-url.mjs +16 -1
- package/dist/is-url.mjs.map +1 -1
- package/dist/property-exists.cjs +31 -1
- package/dist/property-exists.mjs +30 -1
- package/dist/property-exists.mjs.map +1 -1
- package/dist/type-detect.cjs +54 -1
- package/dist/type-detect.mjs +54 -1
- package/dist/type-detect.mjs.map +1 -1
- package/dist/types/src/base.cjs +6 -1
- package/dist/types/src/base.mjs +5 -1
- package/dist/types/src/base.mjs.map +1 -1
- package/package.json +2 -2
package/dist/is-deep-key.cjs
CHANGED
|
@@ -1 +1,52 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/is-deep-key.ts
|
|
3
|
+
/**
|
|
4
|
+
* Checks if a given key is a deep key.
|
|
5
|
+
*
|
|
6
|
+
* A deep key is a string that contains a dot (.) or square brackets with a property accessor.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* isDeepKey('a.b') // true
|
|
10
|
+
* isDeepKey('a[b]') // true
|
|
11
|
+
* isDeepKey('a') // false
|
|
12
|
+
* isDeepKey(123) // false
|
|
13
|
+
* isDeepKey('a.b.c') // true
|
|
14
|
+
* isDeepKey('a[b][c]') // true
|
|
15
|
+
*
|
|
16
|
+
* @param key - The key to check.
|
|
17
|
+
* @returns Returns true if the key is a deep key, otherwise false.
|
|
18
|
+
*/
|
|
19
|
+
function isDeepKey(key) {
|
|
20
|
+
switch (typeof key) {
|
|
21
|
+
case "number":
|
|
22
|
+
case "symbol": return false;
|
|
23
|
+
case "string": return key.includes(".") || key.includes("[") || key.includes("]");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Checks if a given key is a deep key or normal (shallow key).
|
|
28
|
+
*
|
|
29
|
+
* A deep key is a string that contains a dot (.) or square brackets with a property accessor.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* isDeepKey('a.b') // true
|
|
33
|
+
* isDeepKey('a[b]') // true
|
|
34
|
+
* isDeepKey('a') // true
|
|
35
|
+
* isDeepKey(123) // false
|
|
36
|
+
* isDeepKey('a.b.c') // true
|
|
37
|
+
* isDeepKey('a[b][c]') // true
|
|
38
|
+
*
|
|
39
|
+
* @param key - The key to check.
|
|
40
|
+
* @returns Returns true if the key is a deep key, otherwise false.
|
|
41
|
+
*/
|
|
42
|
+
function isKeyOrDeepKey(key) {
|
|
43
|
+
switch (typeof key) {
|
|
44
|
+
case "number": return true;
|
|
45
|
+
case "symbol": return false;
|
|
46
|
+
case "string": return true;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
exports.isDeepKey = isDeepKey;
|
|
52
|
+
exports.isKeyOrDeepKey = isKeyOrDeepKey;
|
package/dist/is-deep-key.mjs
CHANGED
|
@@ -1,2 +1,51 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/is-deep-key.ts
|
|
2
|
+
/**
|
|
3
|
+
* Checks if a given key is a deep key.
|
|
4
|
+
*
|
|
5
|
+
* A deep key is a string that contains a dot (.) or square brackets with a property accessor.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* isDeepKey('a.b') // true
|
|
9
|
+
* isDeepKey('a[b]') // true
|
|
10
|
+
* isDeepKey('a') // false
|
|
11
|
+
* isDeepKey(123) // false
|
|
12
|
+
* isDeepKey('a.b.c') // true
|
|
13
|
+
* isDeepKey('a[b][c]') // true
|
|
14
|
+
*
|
|
15
|
+
* @param key - The key to check.
|
|
16
|
+
* @returns Returns true if the key is a deep key, otherwise false.
|
|
17
|
+
*/
|
|
18
|
+
function isDeepKey(key) {
|
|
19
|
+
switch (typeof key) {
|
|
20
|
+
case "number":
|
|
21
|
+
case "symbol": return false;
|
|
22
|
+
case "string": return key.includes(".") || key.includes("[") || key.includes("]");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Checks if a given key is a deep key or normal (shallow key).
|
|
27
|
+
*
|
|
28
|
+
* A deep key is a string that contains a dot (.) or square brackets with a property accessor.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* isDeepKey('a.b') // true
|
|
32
|
+
* isDeepKey('a[b]') // true
|
|
33
|
+
* isDeepKey('a') // true
|
|
34
|
+
* isDeepKey(123) // false
|
|
35
|
+
* isDeepKey('a.b.c') // true
|
|
36
|
+
* isDeepKey('a[b][c]') // true
|
|
37
|
+
*
|
|
38
|
+
* @param key - The key to check.
|
|
39
|
+
* @returns Returns true if the key is a deep key, otherwise false.
|
|
40
|
+
*/
|
|
41
|
+
function isKeyOrDeepKey(key) {
|
|
42
|
+
switch (typeof key) {
|
|
43
|
+
case "number": return true;
|
|
44
|
+
case "symbol": return false;
|
|
45
|
+
case "string": return true;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
export { isDeepKey, isKeyOrDeepKey };
|
|
2
51
|
//# sourceMappingURL=is-deep-key.mjs.map
|
package/dist/is-deep-key.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-deep-key.mjs","names":[],"sources":["../src/is-deep-key.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 { DeepKey } from \"@stryke/types/object\";\n\n/**\n * Checks if a given key is a deep key.\n *\n * A deep key is a string that contains a dot (.) or square brackets with a property accessor.\n *\n * @example\n * isDeepKey('a.b') // true\n * isDeepKey('a[b]') // true\n * isDeepKey('a') // false\n * isDeepKey(123) // false\n * isDeepKey('a.b.c') // true\n * isDeepKey('a[b][c]') // true\n *\n * @param key - The key to check.\n * @returns Returns true if the key is a deep key, otherwise false.\n */\nexport function isDeepKey(key: PropertyKey): key is DeepKey<any> {\n switch (typeof key) {\n case \"number\":\n case \"symbol\": {\n return false;\n }\n case \"string\": {\n return key.includes(\".\") || key.includes(\"[\") || key.includes(\"]\");\n }\n }\n}\n\n/**\n * Checks if a given key is a deep key or normal (shallow key).\n *\n * A deep key is a string that contains a dot (.) or square brackets with a property accessor.\n *\n * @example\n * isDeepKey('a.b') // true\n * isDeepKey('a[b]') // true\n * isDeepKey('a') // true\n * isDeepKey(123) // false\n * isDeepKey('a.b.c') // true\n * isDeepKey('a[b][c]') // true\n *\n * @param key - The key to check.\n * @returns Returns true if the key is a deep key, otherwise false.\n */\nexport function isKeyOrDeepKey(key: PropertyKey): key is DeepKey<any> {\n switch (typeof key) {\n case \"number\": {\n return true;\n }\n case \"symbol\": {\n return false;\n }\n case \"string\": {\n return true;\n }\n }\n}\n"],"mappings":"AAoCA,SAAgB,
|
|
1
|
+
{"version":3,"file":"is-deep-key.mjs","names":[],"sources":["../src/is-deep-key.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 { DeepKey } from \"@stryke/types/object\";\n\n/**\n * Checks if a given key is a deep key.\n *\n * A deep key is a string that contains a dot (.) or square brackets with a property accessor.\n *\n * @example\n * isDeepKey('a.b') // true\n * isDeepKey('a[b]') // true\n * isDeepKey('a') // false\n * isDeepKey(123) // false\n * isDeepKey('a.b.c') // true\n * isDeepKey('a[b][c]') // true\n *\n * @param key - The key to check.\n * @returns Returns true if the key is a deep key, otherwise false.\n */\nexport function isDeepKey(key: PropertyKey): key is DeepKey<any> {\n switch (typeof key) {\n case \"number\":\n case \"symbol\": {\n return false;\n }\n case \"string\": {\n return key.includes(\".\") || key.includes(\"[\") || key.includes(\"]\");\n }\n }\n}\n\n/**\n * Checks if a given key is a deep key or normal (shallow key).\n *\n * A deep key is a string that contains a dot (.) or square brackets with a property accessor.\n *\n * @example\n * isDeepKey('a.b') // true\n * isDeepKey('a[b]') // true\n * isDeepKey('a') // true\n * isDeepKey(123) // false\n * isDeepKey('a.b.c') // true\n * isDeepKey('a[b][c]') // true\n *\n * @param key - The key to check.\n * @returns Returns true if the key is a deep key, otherwise false.\n */\nexport function isKeyOrDeepKey(key: PropertyKey): key is DeepKey<any> {\n switch (typeof key) {\n case \"number\": {\n return true;\n }\n case \"symbol\": {\n return false;\n }\n case \"string\": {\n return true;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAoCA,SAAgB,UAAU,KAAuC;AAC/D,SAAQ,OAAO,KAAf;EACE,KAAK;EACL,KAAK,SACH,QAAO;EAET,KAAK,SACH,QAAO,IAAI,SAAS,IAAI,IAAI,IAAI,SAAS,IAAI,IAAI,IAAI,SAAS,IAAI;;;;;;;;;;;;;;;;;;;AAqBxE,SAAgB,eAAe,KAAuC;AACpE,SAAQ,OAAO,KAAf;EACE,KAAK,SACH,QAAO;EAET,KAAK,SACH,QAAO;EAET,KAAK,SACH,QAAO"}
|
package/dist/is-empty-object.cjs
CHANGED
|
@@ -1 +1,33 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_is_empty = require('./is-empty.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/is-empty-object.ts
|
|
4
|
+
/**
|
|
5
|
+
* Check if the provided value's type is `{}`
|
|
6
|
+
*
|
|
7
|
+
* @param value - The value to type check
|
|
8
|
+
* @returns An indicator specifying if the value provided is of type `{}`
|
|
9
|
+
*/
|
|
10
|
+
const isEmptyObject = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
return Boolean(value) || Object.keys(value ?? {}).length === 0;
|
|
13
|
+
} catch {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Check if the provided value's type is `null` or `undefined` or `{}`
|
|
19
|
+
*
|
|
20
|
+
* @param value - The value to type check
|
|
21
|
+
* @returns An indicator specifying if the value provided is of type `null` or `undefined` or `{}`
|
|
22
|
+
*/
|
|
23
|
+
const isEmptyOrEmptyObject = (value) => {
|
|
24
|
+
try {
|
|
25
|
+
return require_is_empty.isEmpty(value) || isEmptyObject(value);
|
|
26
|
+
} catch {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
exports.isEmptyObject = isEmptyObject;
|
|
33
|
+
exports.isEmptyOrEmptyObject = isEmptyOrEmptyObject;
|
package/dist/is-empty-object.mjs
CHANGED
|
@@ -1,2 +1,33 @@
|
|
|
1
|
-
import{isEmpty
|
|
1
|
+
import { isEmpty } from "./is-empty.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/is-empty-object.ts
|
|
4
|
+
/**
|
|
5
|
+
* Check if the provided value's type is `{}`
|
|
6
|
+
*
|
|
7
|
+
* @param value - The value to type check
|
|
8
|
+
* @returns An indicator specifying if the value provided is of type `{}`
|
|
9
|
+
*/
|
|
10
|
+
const isEmptyObject = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
return Boolean(value) || Object.keys(value ?? {}).length === 0;
|
|
13
|
+
} catch {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Check if the provided value's type is `null` or `undefined` or `{}`
|
|
19
|
+
*
|
|
20
|
+
* @param value - The value to type check
|
|
21
|
+
* @returns An indicator specifying if the value provided is of type `null` or `undefined` or `{}`
|
|
22
|
+
*/
|
|
23
|
+
const isEmptyOrEmptyObject = (value) => {
|
|
24
|
+
try {
|
|
25
|
+
return isEmpty(value) || isEmptyObject(value);
|
|
26
|
+
} catch {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { isEmptyObject, isEmptyOrEmptyObject };
|
|
2
33
|
//# sourceMappingURL=is-empty-object.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-empty-object.mjs","names":[],"sources":["../src/is-empty-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 { isEmpty } from \"./is-empty\";\n\n/**\n * Check if the provided value's type is `{}`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `{}`\n */\nexport const isEmptyObject = (value: unknown): value is {} => {\n try {\n return Boolean(value) || Object.keys(value ?? {}).length === 0;\n } catch {\n return true;\n }\n};\n\n/**\n * Check if the provided value's type is `null` or `undefined` or `{}`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `null` or `undefined` or `{}`\n */\nexport const isEmptyOrEmptyObject = (value: unknown) => {\n try {\n return isEmpty(value) || isEmptyObject(value);\n } catch {\n return true;\n }\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-empty-object.mjs","names":[],"sources":["../src/is-empty-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 { isEmpty } from \"./is-empty\";\n\n/**\n * Check if the provided value's type is `{}`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `{}`\n */\nexport const isEmptyObject = (value: unknown): value is {} => {\n try {\n return Boolean(value) || Object.keys(value ?? {}).length === 0;\n } catch {\n return true;\n }\n};\n\n/**\n * Check if the provided value's type is `null` or `undefined` or `{}`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `null` or `undefined` or `{}`\n */\nexport const isEmptyOrEmptyObject = (value: unknown) => {\n try {\n return isEmpty(value) || isEmptyObject(value);\n } catch {\n return true;\n }\n};\n"],"mappings":";;;;;;;;;AA0BA,MAAa,iBAAiB,UAAgC;AAC5D,KAAI;AACF,SAAO,QAAQ,MAAM,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC,CAAC,WAAW;SACvD;AACN,SAAO;;;;;;;;;AAUX,MAAa,wBAAwB,UAAmB;AACtD,KAAI;AACF,SAAO,QAAQ,MAAM,IAAI,cAAc,MAAM;SACvC;AACN,SAAO"}
|
package/dist/is-empty-string.cjs
CHANGED
|
@@ -1 +1,20 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_base = require('./types/src/base.cjs');
|
|
2
|
+
const require_is_string = require('./is-string.cjs');
|
|
3
|
+
|
|
4
|
+
//#region src/is-empty-string.ts
|
|
5
|
+
/**
|
|
6
|
+
* Determine if the type is string and is empty
|
|
7
|
+
*
|
|
8
|
+
* @param value - The value to type check
|
|
9
|
+
* @returns An indicator specifying if the value provided is of type `""`
|
|
10
|
+
*/
|
|
11
|
+
const isEmptyString = (value) => {
|
|
12
|
+
try {
|
|
13
|
+
return require_is_string.isString(value) && value === require_base.EMPTY_STRING;
|
|
14
|
+
} catch {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
exports.isEmptyString = isEmptyString;
|
package/dist/is-empty-string.mjs
CHANGED
|
@@ -1,2 +1,21 @@
|
|
|
1
|
-
import{EMPTY_STRING
|
|
1
|
+
import { EMPTY_STRING } from "./types/src/base.mjs";
|
|
2
|
+
import { isString } from "./is-string.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/is-empty-string.ts
|
|
5
|
+
/**
|
|
6
|
+
* Determine if the type is string and is empty
|
|
7
|
+
*
|
|
8
|
+
* @param value - The value to type check
|
|
9
|
+
* @returns An indicator specifying if the value provided is of type `""`
|
|
10
|
+
*/
|
|
11
|
+
const isEmptyString = (value) => {
|
|
12
|
+
try {
|
|
13
|
+
return isString(value) && value === EMPTY_STRING;
|
|
14
|
+
} catch {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { isEmptyString };
|
|
2
21
|
//# sourceMappingURL=is-empty-string.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-empty-string.mjs","names":[],"sources":["../src/is-empty-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 { EMPTY_STRING } from \"@stryke/types/base\";\nimport { isString } from \"./is-string\";\n\n/**\n * Determine if the type is string and is empty\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `\"\"`\n */\nexport const isEmptyString = (value: unknown): value is string => {\n try {\n return isString(value) && value === EMPTY_STRING;\n } catch {\n return false;\n }\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-empty-string.mjs","names":[],"sources":["../src/is-empty-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 { EMPTY_STRING } from \"@stryke/types/base\";\nimport { isString } from \"./is-string\";\n\n/**\n * Determine if the type is string and is empty\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `\"\"`\n */\nexport const isEmptyString = (value: unknown): value is string => {\n try {\n return isString(value) && value === EMPTY_STRING;\n } catch {\n return false;\n }\n};\n"],"mappings":";;;;;;;;;;AA2BA,MAAa,iBAAiB,UAAoC;AAChE,KAAI;AACF,SAAO,SAAS,MAAM,IAAI,UAAU;SAC9B;AACN,SAAO"}
|
package/dist/is-empty.cjs
CHANGED
|
@@ -1 +1,38 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_is_date = require('./is-date.cjs');
|
|
2
|
+
const require_is_function = require('./is-function.cjs');
|
|
3
|
+
const require_is_null = require('./is-null.cjs');
|
|
4
|
+
const require_is_number = require('./is-number.cjs');
|
|
5
|
+
const require_is_symbol = require('./is-symbol.cjs');
|
|
6
|
+
const require_is_undefined = require('./is-undefined.cjs');
|
|
7
|
+
|
|
8
|
+
//#region src/is-empty.ts
|
|
9
|
+
/**
|
|
10
|
+
* Check if the provided value's type is `null` or `undefined`
|
|
11
|
+
*
|
|
12
|
+
* @param value - The value to type check
|
|
13
|
+
* @returns An indicator specifying if the value provided is of type `null` or `undefined`
|
|
14
|
+
*/
|
|
15
|
+
const isEmpty = (value) => {
|
|
16
|
+
try {
|
|
17
|
+
return require_is_undefined.isUndefined(value) || require_is_null.isNull(value);
|
|
18
|
+
} catch {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const isEmptyAnything = (value) => {
|
|
23
|
+
if (value === true || value === false) return true;
|
|
24
|
+
if (value === null || value === void 0) return true;
|
|
25
|
+
if (require_is_number.isNumber(value)) return value === 0;
|
|
26
|
+
if (require_is_date.isDate(value)) return Number.isNaN(value.getTime());
|
|
27
|
+
if (require_is_function.isFunction(value)) return false;
|
|
28
|
+
if (require_is_symbol.isSymbol(value)) return false;
|
|
29
|
+
const { length } = value;
|
|
30
|
+
if (require_is_number.isNumber(length)) return length === 0;
|
|
31
|
+
const { size } = value;
|
|
32
|
+
if (require_is_number.isNumber(size)) return size === 0;
|
|
33
|
+
return Object.keys(value).length === 0;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
exports.isEmpty = isEmpty;
|
|
38
|
+
exports.isEmptyAnything = isEmptyAnything;
|
package/dist/is-empty.mjs
CHANGED
|
@@ -1,2 +1,38 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { isDate } from "./is-date.mjs";
|
|
2
|
+
import { isFunction } from "./is-function.mjs";
|
|
3
|
+
import { isNull } from "./is-null.mjs";
|
|
4
|
+
import { isNumber } from "./is-number.mjs";
|
|
5
|
+
import { isSymbol } from "./is-symbol.mjs";
|
|
6
|
+
import { isUndefined } from "./is-undefined.mjs";
|
|
7
|
+
|
|
8
|
+
//#region src/is-empty.ts
|
|
9
|
+
/**
|
|
10
|
+
* Check if the provided value's type is `null` or `undefined`
|
|
11
|
+
*
|
|
12
|
+
* @param value - The value to type check
|
|
13
|
+
* @returns An indicator specifying if the value provided is of type `null` or `undefined`
|
|
14
|
+
*/
|
|
15
|
+
const isEmpty = (value) => {
|
|
16
|
+
try {
|
|
17
|
+
return isUndefined(value) || isNull(value);
|
|
18
|
+
} catch {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const isEmptyAnything = (value) => {
|
|
23
|
+
if (value === true || value === false) return true;
|
|
24
|
+
if (value === null || value === void 0) return true;
|
|
25
|
+
if (isNumber(value)) return value === 0;
|
|
26
|
+
if (isDate(value)) return Number.isNaN(value.getTime());
|
|
27
|
+
if (isFunction(value)) return false;
|
|
28
|
+
if (isSymbol(value)) return false;
|
|
29
|
+
const { length } = value;
|
|
30
|
+
if (isNumber(length)) return length === 0;
|
|
31
|
+
const { size } = value;
|
|
32
|
+
if (isNumber(size)) return size === 0;
|
|
33
|
+
return Object.keys(value).length === 0;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
export { isEmpty, isEmptyAnything };
|
|
2
38
|
//# sourceMappingURL=is-empty.mjs.map
|
package/dist/is-empty.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-empty.mjs","names":[],"sources":["../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":"
|
|
1
|
+
{"version":3,"file":"is-empty.mjs","names":[],"sources":["../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;;;AAIX,MAAa,mBAAmB,UAAe;AAC7C,KAAI,UAAU,QAAQ,UAAU,MAAO,QAAO;AAC9C,KAAI,UAAU,QAAQ,UAAU,OAAW,QAAO;AAClD,KAAI,SAAS,MAAM,CAAE,QAAO,UAAU;AACtC,KAAI,OAAO,MAAM,CAAE,QAAO,OAAO,MAAM,MAAM,SAAS,CAAC;AACvD,KAAI,WAAW,MAAM,CAAE,QAAO;AAC9B,KAAI,SAAS,MAAM,CAAE,QAAO;CAC5B,MAAM,EAAE,WAAW;AACnB,KAAI,SAAS,OAAO,CAAE,QAAO,WAAW;CACxC,MAAM,EAAE,SAAS;AACjB,KAAI,SAAS,KAAK,CAAE,QAAO,SAAS;AAGpC,QAFa,OAAO,KAAK,MAAM,CAAC,WAEhB"}
|
package/dist/is-equal.cjs
CHANGED
|
@@ -1 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/is-equal.ts
|
|
3
|
+
const isEqual = (x, y) => {
|
|
4
|
+
if (Object.is(x, y)) return true;
|
|
5
|
+
if (x instanceof Date && y instanceof Date) return x.getTime() === y.getTime();
|
|
6
|
+
if (x instanceof RegExp && y instanceof RegExp) return x.toString() === y.toString();
|
|
7
|
+
if (typeof x !== "object" || x === null || typeof y !== "object" || y === null) return false;
|
|
8
|
+
const keysX = Reflect.ownKeys(x);
|
|
9
|
+
const keysY = Reflect.ownKeys(y);
|
|
10
|
+
if (keysX.length !== keysY.length) return false;
|
|
11
|
+
for (const element_ of keysX) {
|
|
12
|
+
if (!Reflect.has(y, element_)) return false;
|
|
13
|
+
if (!isEqual(x[element_], y[element_])) return false;
|
|
14
|
+
}
|
|
15
|
+
return true;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
exports.isEqual = isEqual;
|
package/dist/is-equal.mjs
CHANGED
|
@@ -1,2 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/is-equal.ts
|
|
2
|
+
const isEqual = (x, y) => {
|
|
3
|
+
if (Object.is(x, y)) return true;
|
|
4
|
+
if (x instanceof Date && y instanceof Date) return x.getTime() === y.getTime();
|
|
5
|
+
if (x instanceof RegExp && y instanceof RegExp) return x.toString() === y.toString();
|
|
6
|
+
if (typeof x !== "object" || x === null || typeof y !== "object" || y === null) return false;
|
|
7
|
+
const keysX = Reflect.ownKeys(x);
|
|
8
|
+
const keysY = Reflect.ownKeys(y);
|
|
9
|
+
if (keysX.length !== keysY.length) return false;
|
|
10
|
+
for (const element_ of keysX) {
|
|
11
|
+
if (!Reflect.has(y, element_)) return false;
|
|
12
|
+
if (!isEqual(x[element_], y[element_])) return false;
|
|
13
|
+
}
|
|
14
|
+
return true;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { isEqual };
|
|
2
19
|
//# sourceMappingURL=is-equal.mjs.map
|
package/dist/is-equal.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-equal.mjs","names":[],"sources":["../src/is-equal.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 isEqual = <TType>(x: TType, y: TType): boolean => {\n if (Object.is(x, y)) return true;\n if (x instanceof Date && y instanceof Date) {\n return x.getTime() === y.getTime();\n }\n if (x instanceof RegExp && y instanceof RegExp) {\n return x.toString() === y.toString();\n }\n if (\n typeof x !== \"object\" ||\n x === null ||\n typeof y !== \"object\" ||\n y === null\n ) {\n return false;\n }\n const keysX = Reflect.ownKeys(x as unknown as object) as (keyof typeof x)[];\n const keysY = Reflect.ownKeys(y as unknown as object);\n if (keysX.length !== keysY.length) return false;\n for (const element_ of keysX) {\n if (!Reflect.has(y as unknown as object, element_)) return false;\n if (!isEqual(x[element_], y[element_])) return false;\n }\n return true;\n};\n"],"mappings":"AAkBA,MAAa,
|
|
1
|
+
{"version":3,"file":"is-equal.mjs","names":[],"sources":["../src/is-equal.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 isEqual = <TType>(x: TType, y: TType): boolean => {\n if (Object.is(x, y)) return true;\n if (x instanceof Date && y instanceof Date) {\n return x.getTime() === y.getTime();\n }\n if (x instanceof RegExp && y instanceof RegExp) {\n return x.toString() === y.toString();\n }\n if (\n typeof x !== \"object\" ||\n x === null ||\n typeof y !== \"object\" ||\n y === null\n ) {\n return false;\n }\n const keysX = Reflect.ownKeys(x as unknown as object) as (keyof typeof x)[];\n const keysY = Reflect.ownKeys(y as unknown as object);\n if (keysX.length !== keysY.length) return false;\n for (const element_ of keysX) {\n if (!Reflect.has(y as unknown as object, element_)) return false;\n if (!isEqual(x[element_], y[element_])) return false;\n }\n return true;\n};\n"],"mappings":";AAkBA,MAAa,WAAkB,GAAU,MAAsB;AAC7D,KAAI,OAAO,GAAG,GAAG,EAAE,CAAE,QAAO;AAC5B,KAAI,aAAa,QAAQ,aAAa,KACpC,QAAO,EAAE,SAAS,KAAK,EAAE,SAAS;AAEpC,KAAI,aAAa,UAAU,aAAa,OACtC,QAAO,EAAE,UAAU,KAAK,EAAE,UAAU;AAEtC,KACE,OAAO,MAAM,YACb,MAAM,QACN,OAAO,MAAM,YACb,MAAM,KAEN,QAAO;CAET,MAAM,QAAQ,QAAQ,QAAQ,EAAuB;CACrD,MAAM,QAAQ,QAAQ,QAAQ,EAAuB;AACrD,KAAI,MAAM,WAAW,MAAM,OAAQ,QAAO;AAC1C,MAAK,MAAM,YAAY,OAAO;AAC5B,MAAI,CAAC,QAAQ,IAAI,GAAwB,SAAS,CAAE,QAAO;AAC3D,MAAI,CAAC,QAAQ,EAAE,WAAW,EAAE,UAAU,CAAE,QAAO;;AAEjD,QAAO"}
|
package/dist/is-error.cjs
CHANGED
|
@@ -1 +1,29 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_get_object_tag = require('./get-object-tag.cjs');
|
|
2
|
+
const require_is_plain_object = require('./is-plain-object.cjs');
|
|
3
|
+
const require_is_object = require('./is-object.cjs');
|
|
4
|
+
|
|
5
|
+
//#region src/is-error.ts
|
|
6
|
+
/**
|
|
7
|
+
* Checks if `obj` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
|
|
8
|
+
* `SyntaxError`, `TypeError`, or `URIError` object.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* isError(new Error)
|
|
13
|
+
* // => true
|
|
14
|
+
*
|
|
15
|
+
* isError(Error)
|
|
16
|
+
* // => false
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @param obj - The obj to check.
|
|
20
|
+
* @returns Returns `true` if `obj` is an error object, else `false`.
|
|
21
|
+
*/
|
|
22
|
+
const isError = (obj) => {
|
|
23
|
+
if (!require_is_object.isObject(obj)) return false;
|
|
24
|
+
const tag = require_get_object_tag.getObjectTag(obj);
|
|
25
|
+
return tag === "[object Error]" || tag === "[object DOMException]" || typeof obj?.message === "string" && typeof obj?.name === "string" && !require_is_plain_object.isPlainObject(obj);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
exports.isError = isError;
|
package/dist/is-error.mjs
CHANGED
|
@@ -1,2 +1,30 @@
|
|
|
1
|
-
import{getObjectTag
|
|
1
|
+
import { getObjectTag } from "./get-object-tag.mjs";
|
|
2
|
+
import { isPlainObject } from "./is-plain-object.mjs";
|
|
3
|
+
import { isObject } from "./is-object.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/is-error.ts
|
|
6
|
+
/**
|
|
7
|
+
* Checks if `obj` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
|
|
8
|
+
* `SyntaxError`, `TypeError`, or `URIError` object.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* isError(new Error)
|
|
13
|
+
* // => true
|
|
14
|
+
*
|
|
15
|
+
* isError(Error)
|
|
16
|
+
* // => false
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @param obj - The obj to check.
|
|
20
|
+
* @returns Returns `true` if `obj` is an error object, else `false`.
|
|
21
|
+
*/
|
|
22
|
+
const isError = (obj) => {
|
|
23
|
+
if (!isObject(obj)) return false;
|
|
24
|
+
const tag = getObjectTag(obj);
|
|
25
|
+
return tag === "[object Error]" || tag === "[object DOMException]" || typeof obj?.message === "string" && typeof obj?.name === "string" && !isPlainObject(obj);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
export { isError };
|
|
2
30
|
//# sourceMappingURL=is-error.mjs.map
|
package/dist/is-error.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-error.mjs","names":[],"sources":["../src/is-error.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 { getObjectTag } from \"./get-object-tag\";\nimport { isObject } from \"./is-object\";\nimport { isPlainObject } from \"./is-plain-object\";\n\n/**\n * Checks if `obj` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,\n * `SyntaxError`, `TypeError`, or `URIError` object.\n *\n * @example\n * ```typescript\n * isError(new Error)\n * // => true\n *\n * isError(Error)\n * // => false\n * ```\n *\n * @param obj - The obj to check.\n * @returns Returns `true` if `obj` is an error object, else `false`.\n */\nexport const isError = (obj: unknown): obj is Error => {\n if (!isObject(obj)) {\n return false;\n }\n\n const tag = getObjectTag(obj);\n\n return (\n tag === \"[object Error]\" ||\n tag === \"[object DOMException]\" ||\n (typeof (obj as Error)?.message === \"string\" &&\n typeof (obj as Error)?.name === \"string\" &&\n !isPlainObject(obj))\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-error.mjs","names":[],"sources":["../src/is-error.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 { getObjectTag } from \"./get-object-tag\";\nimport { isObject } from \"./is-object\";\nimport { isPlainObject } from \"./is-plain-object\";\n\n/**\n * Checks if `obj` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,\n * `SyntaxError`, `TypeError`, or `URIError` object.\n *\n * @example\n * ```typescript\n * isError(new Error)\n * // => true\n *\n * isError(Error)\n * // => false\n * ```\n *\n * @param obj - The obj to check.\n * @returns Returns `true` if `obj` is an error object, else `false`.\n */\nexport const isError = (obj: unknown): obj is Error => {\n if (!isObject(obj)) {\n return false;\n }\n\n const tag = getObjectTag(obj);\n\n return (\n tag === \"[object Error]\" ||\n tag === \"[object DOMException]\" ||\n (typeof (obj as Error)?.message === \"string\" &&\n typeof (obj as Error)?.name === \"string\" &&\n !isPlainObject(obj))\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsCA,MAAa,WAAW,QAA+B;AACrD,KAAI,CAAC,SAAS,IAAI,CAChB,QAAO;CAGT,MAAM,MAAM,aAAa,IAAI;AAE7B,QACE,QAAQ,oBACR,QAAQ,2BACP,OAAQ,KAAe,YAAY,YAClC,OAAQ,KAAe,SAAS,YAChC,CAAC,cAAc,IAAI"}
|
package/dist/is-file-result.cjs
CHANGED
|
@@ -1 +1,21 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_is_set_object = require('./is-set-object.cjs');
|
|
2
|
+
const require_is_set_string = require('./is-set-string.cjs');
|
|
3
|
+
|
|
4
|
+
//#region src/is-file-result.ts
|
|
5
|
+
/**
|
|
6
|
+
* Check if the provided value is a `FileResult` object
|
|
7
|
+
*
|
|
8
|
+
* @param value - The value to type check
|
|
9
|
+
* @returns An indicator specifying if the value provided is a `FileResult` object
|
|
10
|
+
*/
|
|
11
|
+
const isFileResult = (value) => {
|
|
12
|
+
return require_is_set_object.isSetObject(value) && "status" in value && [
|
|
13
|
+
"initialized",
|
|
14
|
+
"validated",
|
|
15
|
+
"uploaded",
|
|
16
|
+
"failed"
|
|
17
|
+
].includes(value.status) && (require_is_set_string.isSetString(value?.uri) || require_is_set_object.isSetObject(value?.file));
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
exports.isFileResult = isFileResult;
|
package/dist/is-file-result.mjs
CHANGED
|
@@ -1,2 +1,22 @@
|
|
|
1
|
-
import{isSetObject
|
|
1
|
+
import { isSetObject } from "./is-set-object.mjs";
|
|
2
|
+
import { isSetString } from "./is-set-string.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/is-file-result.ts
|
|
5
|
+
/**
|
|
6
|
+
* Check if the provided value is a `FileResult` object
|
|
7
|
+
*
|
|
8
|
+
* @param value - The value to type check
|
|
9
|
+
* @returns An indicator specifying if the value provided is a `FileResult` object
|
|
10
|
+
*/
|
|
11
|
+
const isFileResult = (value) => {
|
|
12
|
+
return isSetObject(value) && "status" in value && [
|
|
13
|
+
"initialized",
|
|
14
|
+
"validated",
|
|
15
|
+
"uploaded",
|
|
16
|
+
"failed"
|
|
17
|
+
].includes(value.status) && (isSetString(value?.uri) || isSetObject(value?.file));
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { isFileResult };
|
|
2
22
|
//# sourceMappingURL=is-file-result.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-file-result.mjs","names":[],"sources":["../src/is-file-result.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 { FileResult, FileStatus } from \"@stryke/types/file\";\nimport { isSetObject } from \"./is-set-object\";\nimport { isSetString } from \"./is-set-string\";\n\n/**\n * Check if the provided value is a `FileResult` object\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is a `FileResult` object\n */\nexport const isFileResult = (value: any): value is FileResult => {\n return (\n isSetObject(value) &&\n \"status\" in value &&\n [\"initialized\", \"validated\", \"uploaded\", \"failed\"].includes(\n value.status as FileStatus\n ) &&\n (isSetString((value as FileResult)?.uri) ||\n isSetObject((value as FileResult)?.file))\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-file-result.mjs","names":[],"sources":["../src/is-file-result.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 { FileResult, FileStatus } from \"@stryke/types/file\";\nimport { isSetObject } from \"./is-set-object\";\nimport { isSetString } from \"./is-set-string\";\n\n/**\n * Check if the provided value is a `FileResult` object\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is a `FileResult` object\n */\nexport const isFileResult = (value: any): value is FileResult => {\n return (\n isSetObject(value) &&\n \"status\" in value &&\n [\"initialized\", \"validated\", \"uploaded\", \"failed\"].includes(\n value.status as FileStatus\n ) &&\n (isSetString((value as FileResult)?.uri) ||\n isSetObject((value as FileResult)?.file))\n );\n};\n"],"mappings":";;;;;;;;;;AA4BA,MAAa,gBAAgB,UAAoC;AAC/D,QACE,YAAY,MAAM,IAClB,YAAY,SACZ;EAAC;EAAe;EAAa;EAAY;EAAS,CAAC,SACjD,MAAM,OACP,KACA,YAAa,OAAsB,IAAI,IACtC,YAAa,OAAsB,KAAK"}
|
package/dist/is-float.cjs
CHANGED
|
@@ -1 +1,13 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_is_number = require('./is-number.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/is-float.ts
|
|
4
|
+
/**
|
|
5
|
+
* Check if the provided value's type is a float
|
|
6
|
+
*
|
|
7
|
+
* @param value - The value to type check
|
|
8
|
+
* @returns An indicator specifying if the value provided is of type `number` and is a float
|
|
9
|
+
*/
|
|
10
|
+
const isFloat = (value) => require_is_number.isNumber(value) && value % 1 !== 0;
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
exports.isFloat = isFloat;
|
package/dist/is-float.mjs
CHANGED
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
import{isNumber
|
|
1
|
+
import { isNumber } from "./is-number.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/is-float.ts
|
|
4
|
+
/**
|
|
5
|
+
* Check if the provided value's type is a float
|
|
6
|
+
*
|
|
7
|
+
* @param value - The value to type check
|
|
8
|
+
* @returns An indicator specifying if the value provided is of type `number` and is a float
|
|
9
|
+
*/
|
|
10
|
+
const isFloat = (value) => isNumber(value) && value % 1 !== 0;
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { isFloat };
|
|
2
14
|
//# sourceMappingURL=is-float.mjs.map
|
package/dist/is-float.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-float.mjs","names":[],"sources":["../src/is-float.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 { Float } from \"@stryke/types/number\";\nimport { isNumber } from \"./is-number\";\n\n/**\n * Check if the provided value's type is a float\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `number` and is a float\n */\nexport const isFloat = <T extends number>(value: T): value is Float<T> =>\n isNumber(value) && value % 1 !== 0;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-float.mjs","names":[],"sources":["../src/is-float.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 { Float } from \"@stryke/types/number\";\nimport { isNumber } from \"./is-number\";\n\n/**\n * Check if the provided value's type is a float\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `number` and is a float\n */\nexport const isFloat = <T extends number>(value: T): value is Float<T> =>\n isNumber(value) && value % 1 !== 0;\n"],"mappings":";;;;;;;;;AA2BA,MAAa,WAA6B,UACxC,SAAS,MAAM,IAAI,QAAQ,MAAM"}
|