@stryke/type-checks 0.5.18 → 0.5.19
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 +6 -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-function.cjs
CHANGED
|
@@ -1 +1,27 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_get_object_tag = require('./get-object-tag.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/is-function.ts
|
|
4
|
+
function isSyncFunction(value) {
|
|
5
|
+
return require_get_object_tag.getObjectTag(value) === "[object Function]";
|
|
6
|
+
}
|
|
7
|
+
function isAsyncFunction(value) {
|
|
8
|
+
return require_get_object_tag.getObjectTag(value) === "[object AsyncFunction]";
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Check if the provided value's type is `Function`
|
|
12
|
+
*
|
|
13
|
+
* @param value - The value to type check
|
|
14
|
+
* @returns An indicator specifying if the value provided is of type `Function`
|
|
15
|
+
*/
|
|
16
|
+
const isFunction = (value) => {
|
|
17
|
+
try {
|
|
18
|
+
return value instanceof Function || typeof value === "function" || Boolean(value?.constructor && value?.call && value?.apply) || isSyncFunction(value) || isAsyncFunction(value);
|
|
19
|
+
} catch {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
exports.isAsyncFunction = isAsyncFunction;
|
|
26
|
+
exports.isFunction = isFunction;
|
|
27
|
+
exports.isSyncFunction = isSyncFunction;
|
package/dist/is-function.mjs
CHANGED
|
@@ -1,2 +1,26 @@
|
|
|
1
|
-
import{getObjectTag
|
|
1
|
+
import { getObjectTag } from "./get-object-tag.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/is-function.ts
|
|
4
|
+
function isSyncFunction(value) {
|
|
5
|
+
return getObjectTag(value) === "[object Function]";
|
|
6
|
+
}
|
|
7
|
+
function isAsyncFunction(value) {
|
|
8
|
+
return getObjectTag(value) === "[object AsyncFunction]";
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Check if the provided value's type is `Function`
|
|
12
|
+
*
|
|
13
|
+
* @param value - The value to type check
|
|
14
|
+
* @returns An indicator specifying if the value provided is of type `Function`
|
|
15
|
+
*/
|
|
16
|
+
const isFunction = (value) => {
|
|
17
|
+
try {
|
|
18
|
+
return value instanceof Function || typeof value === "function" || Boolean(value?.constructor && value?.call && value?.apply) || isSyncFunction(value) || isAsyncFunction(value);
|
|
19
|
+
} catch {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
export { isAsyncFunction, isFunction, isSyncFunction };
|
|
2
26
|
//# sourceMappingURL=is-function.mjs.map
|
package/dist/is-function.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-function.mjs","names":[],"sources":["../src/is-function.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 { AnyFunction } from \"@stryke/types/base\";\nimport { getObjectTag } from \"./get-object-tag\";\n\nexport function isSyncFunction(value?: any): value is AnyFunction {\n return getObjectTag(value) === \"[object Function]\";\n}\n\nexport function isAsyncFunction(value?: any): value is AnyFunction {\n return getObjectTag(value) === \"[object AsyncFunction]\";\n}\n\n/**\n * Check if the provided value's type is `Function`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `Function`\n */\nexport const isFunction = (value: unknown): value is AnyFunction => {\n try {\n return (\n value instanceof Function ||\n typeof value === \"function\" ||\n Boolean(\n value?.constructor && (value as any)?.call && (value as any)?.apply\n ) ||\n isSyncFunction(value) ||\n isAsyncFunction(value)\n );\n } catch {\n return false;\n }\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-function.mjs","names":[],"sources":["../src/is-function.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 { AnyFunction } from \"@stryke/types/base\";\nimport { getObjectTag } from \"./get-object-tag\";\n\nexport function isSyncFunction(value?: any): value is AnyFunction {\n return getObjectTag(value) === \"[object Function]\";\n}\n\nexport function isAsyncFunction(value?: any): value is AnyFunction {\n return getObjectTag(value) === \"[object AsyncFunction]\";\n}\n\n/**\n * Check if the provided value's type is `Function`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `Function`\n */\nexport const isFunction = (value: unknown): value is AnyFunction => {\n try {\n return (\n value instanceof Function ||\n typeof value === \"function\" ||\n Boolean(\n value?.constructor && (value as any)?.call && (value as any)?.apply\n ) ||\n isSyncFunction(value) ||\n isAsyncFunction(value)\n );\n } catch {\n return false;\n }\n};\n"],"mappings":";;;AAqBA,SAAgB,eAAe,OAAmC;AAChE,QAAO,aAAa,MAAM,KAAK;;AAGjC,SAAgB,gBAAgB,OAAmC;AACjE,QAAO,aAAa,MAAM,KAAK;;;;;;;;AASjC,MAAa,cAAc,UAAyC;AAClE,KAAI;AACF,SACE,iBAAiB,YACjB,OAAO,UAAU,cACjB,QACE,OAAO,eAAgB,OAAe,QAAS,OAAe,MAC/D,IACD,eAAe,MAAM,IACrB,gBAAgB,MAAM;SAElB;AACN,SAAO"}
|
package/dist/is-integer.cjs
CHANGED
|
@@ -1 +1,14 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_is_number = require('./is-number.cjs');
|
|
2
|
+
const require_is_string = require('./is-string.cjs');
|
|
3
|
+
|
|
4
|
+
//#region src/is-integer.ts
|
|
5
|
+
/**
|
|
6
|
+
* Check if the provided value's type is an integer
|
|
7
|
+
*
|
|
8
|
+
* @param value - The value to type check
|
|
9
|
+
* @returns An indicator specifying if the value provided is of type `number` and is an integer
|
|
10
|
+
*/
|
|
11
|
+
const isInteger = (value) => !require_is_string.isString(value) && require_is_number.isNumber(value) && value % 1 === 0;
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
exports.isInteger = isInteger;
|
package/dist/is-integer.mjs
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
import{isNumber
|
|
1
|
+
import { isNumber } from "./is-number.mjs";
|
|
2
|
+
import { isString } from "./is-string.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/is-integer.ts
|
|
5
|
+
/**
|
|
6
|
+
* Check if the provided value's type is an integer
|
|
7
|
+
*
|
|
8
|
+
* @param value - The value to type check
|
|
9
|
+
* @returns An indicator specifying if the value provided is of type `number` and is an integer
|
|
10
|
+
*/
|
|
11
|
+
const isInteger = (value) => !isString(value) && isNumber(value) && value % 1 === 0;
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { isInteger };
|
|
2
15
|
//# sourceMappingURL=is-integer.mjs.map
|
package/dist/is-integer.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-integer.mjs","names":[],"sources":["../src/is-integer.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 { isNumber } from \"./is-number\";\nimport { isString } from \"./is-string\";\n\n/**\n * Check if the provided value's type is an integer\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `number` and is an integer\n */\nexport const isInteger = (value: unknown): boolean =>\n !isString(value) && isNumber(value) && value % 1 === 0;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-integer.mjs","names":[],"sources":["../src/is-integer.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 { isNumber } from \"./is-number\";\nimport { isString } from \"./is-string\";\n\n/**\n * Check if the provided value's type is an integer\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `number` and is an integer\n */\nexport const isInteger = (value: unknown): boolean =>\n !isString(value) && isNumber(value) && value % 1 === 0;\n"],"mappings":";;;;;;;;;;AA2BA,MAAa,aAAa,UACxB,CAAC,SAAS,MAAM,IAAI,SAAS,MAAM,IAAI,QAAQ,MAAM"}
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_is_non_null_object = require('./is-non-null-object.cjs');
|
|
2
|
+
const require_is_react_element = require('./is-react-element.cjs');
|
|
3
|
+
|
|
4
|
+
//#region src/is-mergeable-object.ts
|
|
5
|
+
const isSpecialType = (value) => {
|
|
6
|
+
const stringValue = Object.prototype.toString.call(value);
|
|
7
|
+
return stringValue === "[object RegExp]" || stringValue === "[object Date]" || require_is_react_element.isReactElement(value);
|
|
8
|
+
};
|
|
9
|
+
const isMergeableObject = (value) => {
|
|
10
|
+
return require_is_non_null_object.isNonNullObject(value) && !isSpecialType(value);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
exports.isMergeableObject = isMergeableObject;
|
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
import{isNonNullObject
|
|
1
|
+
import { isNonNullObject } from "./is-non-null-object.mjs";
|
|
2
|
+
import { isReactElement } from "./is-react-element.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/is-mergeable-object.ts
|
|
5
|
+
const isSpecialType = (value) => {
|
|
6
|
+
const stringValue = Object.prototype.toString.call(value);
|
|
7
|
+
return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
|
|
8
|
+
};
|
|
9
|
+
const isMergeableObject = (value) => {
|
|
10
|
+
return isNonNullObject(value) && !isSpecialType(value);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { isMergeableObject };
|
|
2
15
|
//# sourceMappingURL=is-mergeable-object.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-mergeable-object.mjs","names":[],"sources":["../src/is-mergeable-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\";\nimport { isReactElement } from \"./is-react-element\";\n\nconst isSpecialType = (value: any) => {\n const stringValue = Object.prototype.toString.call(value);\n\n return (\n stringValue === \"[object RegExp]\" ||\n stringValue === \"[object Date]\" ||\n isReactElement(value)\n );\n};\n\nexport const isMergeableObject = (value: any): boolean => {\n return isNonNullObject(value) && !isSpecialType(value);\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-mergeable-object.mjs","names":[],"sources":["../src/is-mergeable-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\";\nimport { isReactElement } from \"./is-react-element\";\n\nconst isSpecialType = (value: any) => {\n const stringValue = Object.prototype.toString.call(value);\n\n return (\n stringValue === \"[object RegExp]\" ||\n stringValue === \"[object Date]\" ||\n isReactElement(value)\n );\n};\n\nexport const isMergeableObject = (value: any): boolean => {\n return isNonNullObject(value) && !isSpecialType(value);\n};\n"],"mappings":";;;;AAqBA,MAAM,iBAAiB,UAAe;CACpC,MAAM,cAAc,OAAO,UAAU,SAAS,KAAK,MAAM;AAEzD,QACE,gBAAgB,qBAChB,gBAAgB,mBAChB,eAAe,MAAM;;AAIzB,MAAa,qBAAqB,UAAwB;AACxD,QAAO,gBAAgB,MAAM,IAAI,CAAC,cAAc,MAAM"}
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_is_object = require('./is-object.cjs');
|
|
2
|
+
const require_is_set = require('./is-set.cjs');
|
|
3
|
+
|
|
4
|
+
//#region 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,2 +1,17 @@
|
|
|
1
|
-
import{isObject
|
|
1
|
+
import { isObject } from "./is-object.mjs";
|
|
2
|
+
import { isSet } from "./is-set.mjs";
|
|
3
|
+
|
|
4
|
+
//#region 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 };
|
|
2
17
|
//# sourceMappingURL=is-non-null-object.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-non-null-object.mjs","names":[],"sources":["../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":"
|
|
1
|
+
{"version":3,"file":"is-non-null-object.mjs","names":[],"sources":["../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"}
|
package/dist/is-not-empty.cjs
CHANGED
|
@@ -1 +1,21 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_is_empty = require('./is-empty.cjs');
|
|
2
|
+
const require_is_empty_object = require('./is-empty-object.cjs');
|
|
3
|
+
const require_is_empty_string = require('./is-empty-string.cjs');
|
|
4
|
+
|
|
5
|
+
//#region src/is-not-empty.ts
|
|
6
|
+
/**
|
|
7
|
+
* The inverse of the `isEmptyObject` function
|
|
8
|
+
*
|
|
9
|
+
* @param value - The value to type check
|
|
10
|
+
* @returns An indicator specifying if the value provided is **NOT** of type `null` or `undefined` or `{}`
|
|
11
|
+
*/
|
|
12
|
+
const isNotEmpty = (value) => {
|
|
13
|
+
try {
|
|
14
|
+
return !require_is_empty.isEmpty(value) && !require_is_empty_string.isEmptyString(value) && !require_is_empty_object.isEmptyObject(value);
|
|
15
|
+
} catch {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
exports.isNotEmpty = isNotEmpty;
|
package/dist/is-not-empty.mjs
CHANGED
|
@@ -1,2 +1,22 @@
|
|
|
1
|
-
import{isEmpty
|
|
1
|
+
import { isEmpty } from "./is-empty.mjs";
|
|
2
|
+
import { isEmptyObject } from "./is-empty-object.mjs";
|
|
3
|
+
import { isEmptyString } from "./is-empty-string.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/is-not-empty.ts
|
|
6
|
+
/**
|
|
7
|
+
* The inverse of the `isEmptyObject` function
|
|
8
|
+
*
|
|
9
|
+
* @param value - The value to type check
|
|
10
|
+
* @returns An indicator specifying if the value provided is **NOT** of type `null` or `undefined` or `{}`
|
|
11
|
+
*/
|
|
12
|
+
const isNotEmpty = (value) => {
|
|
13
|
+
try {
|
|
14
|
+
return !isEmpty(value) && !isEmptyString(value) && !isEmptyObject(value);
|
|
15
|
+
} catch {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { isNotEmpty };
|
|
2
22
|
//# sourceMappingURL=is-not-empty.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-not-empty.mjs","names":[],"sources":["../src/is-not-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 { isEmpty } from \"./is-empty\";\nimport { isEmptyObject } from \"./is-empty-object\";\nimport { isEmptyString } from \"./is-empty-string\";\n\n/**\n * The inverse of the `isEmptyObject` 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` or `{}`\n */\nexport const isNotEmpty = (value: unknown): value is NonNullable<unknown> => {\n try {\n return !isEmpty(value) && !isEmptyString(value) && !isEmptyObject(value);\n } catch {\n return false;\n }\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-not-empty.mjs","names":[],"sources":["../src/is-not-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 { isEmpty } from \"./is-empty\";\nimport { isEmptyObject } from \"./is-empty-object\";\nimport { isEmptyString } from \"./is-empty-string\";\n\n/**\n * The inverse of the `isEmptyObject` 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` or `{}`\n */\nexport const isNotEmpty = (value: unknown): value is NonNullable<unknown> => {\n try {\n return !isEmpty(value) && !isEmptyString(value) && !isEmptyObject(value);\n } catch {\n return false;\n }\n};\n"],"mappings":";;;;;;;;;;;AA4BA,MAAa,cAAc,UAAkD;AAC3E,KAAI;AACF,SAAO,CAAC,QAAQ,MAAM,IAAI,CAAC,cAAc,MAAM,IAAI,CAAC,cAAc,MAAM;SAClE;AACN,SAAO"}
|
package/dist/is-null.cjs
CHANGED
package/dist/is-null.mjs
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
//#region 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 };
|
|
2
12
|
//# sourceMappingURL=is-null.mjs.map
|
package/dist/is-null.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-null.mjs","names":[],"sources":["../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,
|
|
1
|
+
{"version":3,"file":"is-null.mjs","names":[],"sources":["../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"}
|
package/dist/is-number.cjs
CHANGED
|
@@ -1 +1,29 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_get_object_tag = require('./get-object-tag.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/is-number.ts
|
|
4
|
+
/**
|
|
5
|
+
* Check if the provided value's type is `number`
|
|
6
|
+
*
|
|
7
|
+
* @param value - The value to type check
|
|
8
|
+
* @returns An indicator specifying if the value provided is of type `number`
|
|
9
|
+
*/
|
|
10
|
+
const isNumber = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
return value instanceof Number || typeof value === "number" || Number(value) === value;
|
|
13
|
+
} catch {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Check if the provided value's type is `AnyNumber`
|
|
19
|
+
*
|
|
20
|
+
* @param value - The value to type check
|
|
21
|
+
* @returns An indicator specifying if the value provided is of type `AnyNumber`
|
|
22
|
+
*/
|
|
23
|
+
function isAnyNumber(value) {
|
|
24
|
+
return isNumber(value) || require_get_object_tag.getObjectTag(value) === "[object Number]";
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
exports.isAnyNumber = isAnyNumber;
|
|
29
|
+
exports.isNumber = isNumber;
|
package/dist/is-number.mjs
CHANGED
|
@@ -1,2 +1,29 @@
|
|
|
1
|
-
import{getObjectTag
|
|
1
|
+
import { getObjectTag } from "./get-object-tag.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/is-number.ts
|
|
4
|
+
/**
|
|
5
|
+
* Check if the provided value's type is `number`
|
|
6
|
+
*
|
|
7
|
+
* @param value - The value to type check
|
|
8
|
+
* @returns An indicator specifying if the value provided is of type `number`
|
|
9
|
+
*/
|
|
10
|
+
const isNumber = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
return value instanceof Number || typeof value === "number" || Number(value) === value;
|
|
13
|
+
} catch {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Check if the provided value's type is `AnyNumber`
|
|
19
|
+
*
|
|
20
|
+
* @param value - The value to type check
|
|
21
|
+
* @returns An indicator specifying if the value provided is of type `AnyNumber`
|
|
22
|
+
*/
|
|
23
|
+
function isAnyNumber(value) {
|
|
24
|
+
return isNumber(value) || getObjectTag(value) === "[object Number]";
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { isAnyNumber, isNumber };
|
|
2
29
|
//# sourceMappingURL=is-number.mjs.map
|
package/dist/is-number.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-number.mjs","names":[],"sources":["../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":"
|
|
1
|
+
{"version":3,"file":"is-number.mjs","names":[],"sources":["../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;;;;;;;;;AAUX,SAAgB,YAAY,OAAiC;AAC3D,QAAO,SAAS,MAAM,IAAI,aAAa,MAAM,KAAK"}
|
package/dist/is-object-index.cjs
CHANGED
|
@@ -1 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region 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
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
exports.isObjectIndex = isObjectIndex;
|
package/dist/is-object-index.mjs
CHANGED
|
@@ -1,2 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
//#region 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
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { isObjectIndex };
|
|
2
19
|
//# sourceMappingURL=is-object-index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-object-index.mjs","names":[],"sources":["../src/is-object-index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nconst IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if the given value is an object index.\n *\n * @param value - The value to check.\n * @returns Returns `true` if the value is an object index, otherwise `false`.\n */\nexport function isObjectIndex(\n value: PropertyKey\n): value is string | number | symbol {\n switch (typeof value) {\n case \"number\": {\n return (\n Number.isInteger(value) && value >= 0 && value < Number.MAX_SAFE_INTEGER\n );\n }\n case \"symbol\": {\n return false;\n }\n case \"string\": {\n return IS_UNSIGNED_INTEGER.test(value);\n }\n }\n}\n"],"mappings":"AAkBA,MAAM,
|
|
1
|
+
{"version":3,"file":"is-object-index.mjs","names":[],"sources":["../src/is-object-index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nconst IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if the given value is an object index.\n *\n * @param value - The value to check.\n * @returns Returns `true` if the value is an object index, otherwise `false`.\n */\nexport function isObjectIndex(\n value: PropertyKey\n): value is string | number | symbol {\n switch (typeof value) {\n case \"number\": {\n return (\n Number.isInteger(value) && value >= 0 && value < Number.MAX_SAFE_INTEGER\n );\n }\n case \"symbol\": {\n return false;\n }\n case \"string\": {\n return IS_UNSIGNED_INTEGER.test(value);\n }\n }\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"}
|
package/dist/is-object.cjs
CHANGED
|
@@ -1 +1,47 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_is_plain_object = require('./is-plain-object.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/is-object.ts
|
|
4
|
+
const isClassRegex = /^class\s|^function\s+[A-Z]/;
|
|
5
|
+
const isConventionalClassRegex = /^function\s+[A-Z]/;
|
|
6
|
+
const isNativeClassRegex = /^class\s/;
|
|
7
|
+
/** Is ES6+ class */
|
|
8
|
+
function isNativeClass(value) {
|
|
9
|
+
return typeof value === "function" && isNativeClassRegex.test(value.toString());
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Check if the provided value's type is a conventional class
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Is Conventional Class
|
|
16
|
+
* Looks for function with capital first letter MyClass
|
|
17
|
+
* First letter is the 9th character
|
|
18
|
+
* If changed, isClass must also be updated
|
|
19
|
+
*
|
|
20
|
+
* @param value - The value to type check
|
|
21
|
+
* @returns An indicator specifying if the value provided is a conventional class
|
|
22
|
+
*/
|
|
23
|
+
function isConventionalClass(value) {
|
|
24
|
+
return typeof value === "function" && isConventionalClassRegex.test(value.toString());
|
|
25
|
+
}
|
|
26
|
+
function isClass(value) {
|
|
27
|
+
return typeof value === "function" && isClassRegex.test(value.toString());
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Check if the provided value's type is `Object`
|
|
31
|
+
*
|
|
32
|
+
* @param value - The value to type check
|
|
33
|
+
* @returns An indicator specifying if the value provided is of type `Object`
|
|
34
|
+
*/
|
|
35
|
+
const isObject = (value) => {
|
|
36
|
+
try {
|
|
37
|
+
return typeof value === "object" || Boolean(value) && value?.constructor === Object || require_is_plain_object.isPlainObject(value);
|
|
38
|
+
} catch {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
exports.isClass = isClass;
|
|
45
|
+
exports.isConventionalClass = isConventionalClass;
|
|
46
|
+
exports.isNativeClass = isNativeClass;
|
|
47
|
+
exports.isObject = isObject;
|
package/dist/is-object.mjs
CHANGED
|
@@ -1,2 +1,45 @@
|
|
|
1
|
-
import{isPlainObject
|
|
1
|
+
import { isPlainObject } from "./is-plain-object.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/is-object.ts
|
|
4
|
+
const isClassRegex = /^class\s|^function\s+[A-Z]/;
|
|
5
|
+
const isConventionalClassRegex = /^function\s+[A-Z]/;
|
|
6
|
+
const isNativeClassRegex = /^class\s/;
|
|
7
|
+
/** Is ES6+ class */
|
|
8
|
+
function isNativeClass(value) {
|
|
9
|
+
return typeof value === "function" && isNativeClassRegex.test(value.toString());
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Check if the provided value's type is a conventional class
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Is Conventional Class
|
|
16
|
+
* Looks for function with capital first letter MyClass
|
|
17
|
+
* First letter is the 9th character
|
|
18
|
+
* If changed, isClass must also be updated
|
|
19
|
+
*
|
|
20
|
+
* @param value - The value to type check
|
|
21
|
+
* @returns An indicator specifying if the value provided is a conventional class
|
|
22
|
+
*/
|
|
23
|
+
function isConventionalClass(value) {
|
|
24
|
+
return typeof value === "function" && isConventionalClassRegex.test(value.toString());
|
|
25
|
+
}
|
|
26
|
+
function isClass(value) {
|
|
27
|
+
return typeof value === "function" && isClassRegex.test(value.toString());
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Check if the provided value's type is `Object`
|
|
31
|
+
*
|
|
32
|
+
* @param value - The value to type check
|
|
33
|
+
* @returns An indicator specifying if the value provided is of type `Object`
|
|
34
|
+
*/
|
|
35
|
+
const isObject = (value) => {
|
|
36
|
+
try {
|
|
37
|
+
return typeof value === "object" || Boolean(value) && value?.constructor === Object || isPlainObject(value);
|
|
38
|
+
} catch {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
export { isClass, isConventionalClass, isNativeClass, isObject };
|
|
2
45
|
//# sourceMappingURL=is-object.mjs.map
|
package/dist/is-object.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-object.mjs","names":[],"sources":["../src/is-object.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/* eslint-disable ts/no-unsafe-function-type */\n/* eslint-disable ts/no-unsafe-call */\n\nimport type { NativeClass } from \"@stryke/types/base\";\nimport { isPlainObject } from \"./is-plain-object\";\n\n// Prepare\nconst isClassRegex = /^class\\s|^function\\s+[A-Z]/;\nconst isConventionalClassRegex = /^function\\s+[A-Z]/;\nconst isNativeClassRegex = /^class\\s/;\n\n/** Is ES6+ class */\nexport function isNativeClass(value?: any): value is NativeClass {\n // NOTE TO DEVELOPER: If any of this changes, isClass must also be updated\n return (\n typeof value === \"function\" && isNativeClassRegex.test(value.toString())\n );\n}\n\n/**\n * Check if the provided value's type is a conventional class\n *\n * @remarks\n * Is Conventional Class\n * Looks for function with capital first letter MyClass\n * First letter is the 9th character\n * If changed, isClass must also be updated\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is a conventional class\n */\nexport function isConventionalClass(value?: any): value is Function {\n return (\n typeof value === \"function\" &&\n isConventionalClassRegex.test(value.toString())\n );\n}\n\n/**\n * Check if the provided value's type is `Object`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `Object`\n */\nexport function isClass(value?: any): value is Function | NativeClass; // only guarantee of truth type, not of validity\nexport function isClass(value?: any): boolean {\n return typeof value === \"function\" && isClassRegex.test(value.toString());\n}\n\n/**\n * Check if the provided value's type is `Object`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `Object`\n */\nexport const isObject = (value: unknown): value is object => {\n try {\n return (\n typeof value === \"object\" ||\n (Boolean(value) && value?.constructor === Object) ||\n isPlainObject(value)\n );\n } catch {\n return false;\n }\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-object.mjs","names":[],"sources":["../src/is-object.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/* eslint-disable ts/no-unsafe-function-type */\n/* eslint-disable ts/no-unsafe-call */\n\nimport type { NativeClass } from \"@stryke/types/base\";\nimport { isPlainObject } from \"./is-plain-object\";\n\n// Prepare\nconst isClassRegex = /^class\\s|^function\\s+[A-Z]/;\nconst isConventionalClassRegex = /^function\\s+[A-Z]/;\nconst isNativeClassRegex = /^class\\s/;\n\n/** Is ES6+ class */\nexport function isNativeClass(value?: any): value is NativeClass {\n // NOTE TO DEVELOPER: If any of this changes, isClass must also be updated\n return (\n typeof value === \"function\" && isNativeClassRegex.test(value.toString())\n );\n}\n\n/**\n * Check if the provided value's type is a conventional class\n *\n * @remarks\n * Is Conventional Class\n * Looks for function with capital first letter MyClass\n * First letter is the 9th character\n * If changed, isClass must also be updated\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is a conventional class\n */\nexport function isConventionalClass(value?: any): value is Function {\n return (\n typeof value === \"function\" &&\n isConventionalClassRegex.test(value.toString())\n );\n}\n\n/**\n * Check if the provided value's type is `Object`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `Object`\n */\nexport function isClass(value?: any): value is Function | NativeClass; // only guarantee of truth type, not of validity\nexport function isClass(value?: any): boolean {\n return typeof value === \"function\" && isClassRegex.test(value.toString());\n}\n\n/**\n * Check if the provided value's type is `Object`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `Object`\n */\nexport const isObject = (value: unknown): value is object => {\n try {\n return (\n typeof value === \"object\" ||\n (Boolean(value) && value?.constructor === Object) ||\n isPlainObject(value)\n );\n } catch {\n return false;\n }\n};\n"],"mappings":";;;AAyBA,MAAM,eAAe;AACrB,MAAM,2BAA2B;AACjC,MAAM,qBAAqB;;AAG3B,SAAgB,cAAc,OAAmC;AAE/D,QACE,OAAO,UAAU,cAAc,mBAAmB,KAAK,MAAM,UAAU,CAAC;;;;;;;;;;;;;;AAgB5E,SAAgB,oBAAoB,OAAgC;AAClE,QACE,OAAO,UAAU,cACjB,yBAAyB,KAAK,MAAM,UAAU,CAAC;;AAWnD,SAAgB,QAAQ,OAAsB;AAC5C,QAAO,OAAO,UAAU,cAAc,aAAa,KAAK,MAAM,UAAU,CAAC;;;;;;;;AAS3E,MAAa,YAAY,UAAoC;AAC3D,KAAI;AACF,SACE,OAAO,UAAU,YAChB,QAAQ,MAAM,IAAI,OAAO,gBAAgB,UAC1C,cAAc,MAAM;SAEhB;AACN,SAAO"}
|
package/dist/is-plain-object.cjs
CHANGED
|
@@ -1 +1,64 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_get_object_tag = require('./get-object-tag.cjs');
|
|
2
|
+
|
|
3
|
+
//#region 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.isObjectLike = isObjectLike;
|
|
64
|
+
exports.isPlainObject = isPlainObject;
|