@stryke/json 0.9.44 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/code-frames-BUtrssZ5.d.cts +17 -0
- package/dist/code-frames-BUtrssZ5.d.cts.map +1 -0
- package/dist/code-frames-BmUvlJ0w.cjs +82 -0
- package/dist/code-frames-CrTAYYSE.d.mts +17 -0
- package/dist/code-frames-CrTAYYSE.d.mts.map +1 -0
- package/dist/code-frames-DuBfTMu4.mjs +77 -0
- package/dist/code-frames-DuBfTMu4.mjs.map +1 -0
- package/dist/find-reference-B8xshNXL.d.mts +52 -0
- package/dist/find-reference-B8xshNXL.d.mts.map +1 -0
- package/dist/find-reference-C-YleCds.d.cts +52 -0
- package/dist/find-reference-C-YleCds.d.cts.map +1 -0
- package/dist/find-reference-DMSYEaaI.mjs +64 -0
- package/dist/find-reference-DMSYEaaI.mjs.map +1 -0
- package/dist/find-reference-De5vBQV2.cjs +86 -0
- package/dist/index-B_e8BwCm.d.cts +1 -0
- package/dist/index-CCt0lwyI.d.mts +1 -0
- package/dist/index-CDAfh8Ew.d.cts +1 -0
- package/dist/index-DvuJXuAN.d.mts +1 -0
- package/dist/index.cjs +37 -14
- package/dist/index.d.cts +11 -8
- package/dist/index.d.mts +12 -9
- package/dist/index.mjs +13 -8
- package/dist/is-number-BIwzZzyi.mjs +31 -0
- package/dist/is-number-BIwzZzyi.mjs.map +1 -0
- package/dist/is-number-c5xguIbS.cjs +42 -0
- package/dist/{type-checks/src/is-plain-object.mjs → is-object-BpfmzHWa.mjs} +19 -3
- package/dist/is-object-BpfmzHWa.mjs.map +1 -0
- package/dist/{type-checks/src/is-plain-object.cjs → is-object-umGh91v1.cjs} +24 -3
- package/dist/is-set-object-BmHip9em.cjs +108 -0
- package/dist/is-set-object-C1Qnj1Q8.mjs +98 -0
- package/dist/is-set-object-C1Qnj1Q8.mjs.map +1 -0
- package/dist/{type-checks/src/is-string.mjs → is-string-C2RK4Gjs.cjs} +7 -2
- package/dist/{type-checks/src/is-string.cjs → is-string-CLiBUSKV.mjs} +2 -2
- package/dist/is-string-CLiBUSKV.mjs.map +1 -0
- package/dist/{type-checks/src/is-undefined.cjs → is-undefined-CmyJWYGD.mjs} +2 -2
- package/dist/is-undefined-CmyJWYGD.mjs.map +1 -0
- package/dist/{type-checks/src/is-undefined.mjs → is-undefined-CnI0qe-z.cjs} +7 -2
- package/dist/parse-BGlhbY16.d.cts +9 -0
- package/dist/parse-BGlhbY16.d.cts.map +1 -0
- package/dist/parse-Bp6kkcQ4.cjs +127 -0
- package/dist/parse-ByDxRup5.cjs +62 -0
- package/dist/parse-Cj-YfhrI.d.mts +51 -0
- package/dist/parse-Cj-YfhrI.d.mts.map +1 -0
- package/dist/parse-DZfi3d96.d.cts +51 -0
- package/dist/parse-DZfi3d96.d.cts.map +1 -0
- package/dist/parse-Dn43ZK9y.mjs +52 -0
- package/dist/parse-Dn43ZK9y.mjs.map +1 -0
- package/dist/parse-error-7K8s4vWf.d.cts +15 -0
- package/dist/parse-error-7K8s4vWf.d.cts.map +1 -0
- package/dist/parse-error-Af4zHUQ_.mjs +34 -0
- package/dist/parse-error-Af4zHUQ_.mjs.map +1 -0
- package/dist/parse-error-DpEv3vo_.d.mts +15 -0
- package/dist/parse-error-DpEv3vo_.d.mts.map +1 -0
- package/dist/parse-error-N7UE-HMh.cjs +39 -0
- package/dist/parse-fXy5pbmE.d.mts +9 -0
- package/dist/parse-fXy5pbmE.d.mts.map +1 -0
- package/dist/parse-vw_qRD3F.mjs +81 -0
- package/dist/parse-vw_qRD3F.mjs.map +1 -0
- package/dist/pointer/find-reference.cjs +5 -65
- package/dist/pointer/find-reference.d.cts +2 -52
- package/dist/pointer/find-reference.d.mts +2 -52
- package/dist/pointer/find-reference.mjs +2 -63
- package/dist/pointer/index.cjs +15 -14
- package/dist/pointer/index.d.cts +2 -2
- package/dist/pointer/index.d.mts +2 -2
- package/dist/pointer/index.mjs +3 -2
- package/dist/pointer/parse.cjs +9 -86
- package/dist/pointer/parse.d.cts +2 -44
- package/dist/pointer/parse.d.mts +2 -44
- package/dist/pointer/parse.mjs +2 -80
- package/dist/pointer-B3W_Sme3.cjs +0 -0
- package/dist/pointer-Dn__XOdY.mjs +0 -0
- package/dist/schema-BO1HCrxv.d.cts +55 -0
- package/dist/schema-BO1HCrxv.d.cts.map +1 -0
- package/dist/schema-CmH1V_uI.d.mts +55 -0
- package/dist/schema-CmH1V_uI.d.mts.map +1 -0
- package/dist/schema-DGmzxHja.mjs +72 -0
- package/dist/schema-DGmzxHja.mjs.map +1 -0
- package/dist/schema-Dl018Aq4.cjs +106 -0
- package/dist/schema.cjs +8 -0
- package/dist/schema.d.cts +2 -0
- package/dist/schema.d.mts +3 -0
- package/dist/schema.mjs +3 -0
- package/dist/storm-json-8F9CKpXu.d.mts +70 -0
- package/dist/storm-json-8F9CKpXu.d.mts.map +1 -0
- package/dist/storm-json-BD6WFbrI.cjs +154 -0
- package/dist/storm-json-DvIEWMEH.d.cts +70 -0
- package/dist/storm-json-DvIEWMEH.d.cts.map +1 -0
- package/dist/storm-json-nkhJgTz4.mjs +116 -0
- package/dist/storm-json-nkhJgTz4.mjs.map +1 -0
- package/dist/storm-json.cjs +3 -116
- package/dist/storm-json.d.cts +2 -70
- package/dist/storm-json.d.mts +3 -70
- package/dist/storm-json.mjs +3 -115
- package/dist/stringify-Bc8OkhIr.d.cts +13 -0
- package/dist/stringify-Bc8OkhIr.d.cts.map +1 -0
- package/dist/stringify-BehjrfhS.cjs +78 -0
- package/dist/stringify-CFT1K1LE.d.mts +13 -0
- package/dist/stringify-CFT1K1LE.d.mts.map +1 -0
- package/dist/stringify-CYHjAvWm.mjs +68 -0
- package/dist/stringify-CYHjAvWm.mjs.map +1 -0
- package/dist/strip-comments-BA8MS_Fs.d.mts +11 -0
- package/dist/strip-comments-BA8MS_Fs.d.mts.map +1 -0
- package/dist/strip-comments-CmEG_smS.cjs +94 -0
- package/dist/strip-comments-Cz_Wc25t.d.cts +11 -0
- package/dist/strip-comments-Cz_Wc25t.d.cts.map +1 -0
- package/dist/strip-comments-Dq00N_Sg.mjs +89 -0
- package/dist/strip-comments-Dq00N_Sg.mjs.map +1 -0
- package/dist/types-Bn8rC098.d.cts +222 -0
- package/dist/types-Bn8rC098.d.cts.map +1 -0
- package/dist/types-CPQlxauZ.d.mts +222 -0
- package/dist/types-CPQlxauZ.d.mts.map +1 -0
- package/dist/types.d.cts +2 -69
- package/dist/types.d.mts +2 -69
- package/dist/types.mjs +0 -1
- package/dist/utils/code-frames.cjs +2 -76
- package/dist/utils/code-frames.d.cts +2 -17
- package/dist/utils/code-frames.d.mts +2 -17
- package/dist/utils/code-frames.mjs +2 -76
- package/dist/utils/index.cjs +13 -12
- package/dist/utils/index.d.cts +5 -5
- package/dist/utils/index.d.mts +6 -5
- package/dist/utils/index.mjs +6 -5
- package/dist/utils/parse-error.cjs +2 -33
- package/dist/utils/parse-error.d.cts +2 -15
- package/dist/utils/parse-error.d.mts +2 -15
- package/dist/utils/parse-error.mjs +2 -33
- package/dist/utils/parse.cjs +3 -51
- package/dist/utils/parse.d.cts +2 -9
- package/dist/utils/parse.d.mts +2 -9
- package/dist/utils/parse.mjs +2 -51
- package/dist/utils/stringify.cjs +3 -67
- package/dist/utils/stringify.d.cts +2 -13
- package/dist/utils/stringify.d.mts +2 -13
- package/dist/utils/stringify.mjs +2 -67
- package/dist/utils/strip-comments.cjs +2 -85
- package/dist/utils/strip-comments.d.cts +2 -11
- package/dist/utils/strip-comments.d.mts +2 -11
- package/dist/utils/strip-comments.mjs +2 -86
- package/dist/utils-jN2UkvqB.cjs +0 -0
- package/dist/utils-mEkKIcgl.mjs +0 -0
- package/package.json +12 -3
- package/dist/_virtual/rolldown_runtime.cjs +0 -29
- package/dist/pointer/find-reference.d.cts.map +0 -1
- package/dist/pointer/find-reference.d.mts.map +0 -1
- package/dist/pointer/find-reference.mjs.map +0 -1
- package/dist/pointer/parse.d.cts.map +0 -1
- package/dist/pointer/parse.d.mts.map +0 -1
- package/dist/pointer/parse.mjs.map +0 -1
- package/dist/storm-json.d.cts.map +0 -1
- package/dist/storm-json.d.mts.map +0 -1
- package/dist/storm-json.mjs.map +0 -1
- package/dist/type-checks/src/get-object-tag.cjs +0 -15
- package/dist/type-checks/src/get-object-tag.mjs +0 -15
- package/dist/type-checks/src/get-object-tag.mjs.map +0 -1
- package/dist/type-checks/src/is-empty.cjs +0 -20
- package/dist/type-checks/src/is-empty.mjs +0 -21
- package/dist/type-checks/src/is-empty.mjs.map +0 -1
- package/dist/type-checks/src/is-non-null-object.cjs +0 -16
- package/dist/type-checks/src/is-non-null-object.mjs +0 -17
- package/dist/type-checks/src/is-non-null-object.mjs.map +0 -1
- package/dist/type-checks/src/is-null.cjs +0 -12
- package/dist/type-checks/src/is-null.mjs +0 -12
- package/dist/type-checks/src/is-null.mjs.map +0 -1
- package/dist/type-checks/src/is-number.cjs +0 -18
- package/dist/type-checks/src/is-number.mjs +0 -18
- package/dist/type-checks/src/is-number.mjs.map +0 -1
- package/dist/type-checks/src/is-object.cjs +0 -19
- package/dist/type-checks/src/is-object.mjs +0 -20
- package/dist/type-checks/src/is-object.mjs.map +0 -1
- package/dist/type-checks/src/is-plain-object.mjs.map +0 -1
- package/dist/type-checks/src/is-set-object.cjs +0 -19
- package/dist/type-checks/src/is-set-object.mjs +0 -20
- package/dist/type-checks/src/is-set-object.mjs.map +0 -1
- package/dist/type-checks/src/is-set.cjs +0 -19
- package/dist/type-checks/src/is-set.mjs +0 -20
- package/dist/type-checks/src/is-set.mjs.map +0 -1
- package/dist/type-checks/src/is-string.mjs.map +0 -1
- package/dist/type-checks/src/is-undefined.mjs.map +0 -1
- package/dist/types/src/base.cjs +0 -6
- package/dist/types/src/base.mjs +0 -6
- package/dist/types/src/base.mjs.map +0 -1
- package/dist/types/src/json.d.cts +0 -12
- package/dist/types/src/json.d.cts.map +0 -1
- package/dist/types/src/json.d.mts +0 -12
- package/dist/types/src/json.d.mts.map +0 -1
- package/dist/types.d.cts.map +0 -1
- package/dist/types.d.mts.map +0 -1
- package/dist/utils/code-frames.d.cts.map +0 -1
- package/dist/utils/code-frames.d.mts.map +0 -1
- package/dist/utils/code-frames.mjs.map +0 -1
- package/dist/utils/parse-error.d.cts.map +0 -1
- package/dist/utils/parse-error.d.mts.map +0 -1
- package/dist/utils/parse-error.mjs.map +0 -1
- package/dist/utils/parse.d.cts.map +0 -1
- package/dist/utils/parse.d.mts.map +0 -1
- package/dist/utils/parse.mjs.map +0 -1
- package/dist/utils/stringify.d.cts.map +0 -1
- package/dist/utils/stringify.d.mts.map +0 -1
- package/dist/utils/stringify.mjs.map +0 -1
- package/dist/utils/strip-comments.d.cts.map +0 -1
- package/dist/utils/strip-comments.d.mts.map +0 -1
- package/dist/utils/strip-comments.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import "./
|
|
9
|
-
|
|
1
|
+
import { a as isArrayEnd, i as find, n as ObjectReference, o as isArrayReference, r as Reference, s as isObjectReference, t as ArrayReference } from "./find-reference-B8xshNXL.mjs";
|
|
2
|
+
import { a as isValidIndex, c as unescapePointerSegment, i as isRoot, n as formatJsonPointer, o as parent, r as isInteger, s as parseJsonPointer, t as escapePointerSegment } from "./parse-Cj-YfhrI.mjs";
|
|
3
|
+
import { $ as TypeAnnotation, A as JsonSchema7PrimitiveLiteralType, B as JsonSchema7UndefinedType, C as JsonSchema7NativeEnumType, D as JsonSchema7NumberType, E as JsonSchema7NullableType, F as JsonSchema7SetType, G as Leaf, H as JsonSchema7UnknownType, I as JsonSchema7StringType, J as PrimitiveTypeAnnotation, K as LeafTypeAnnotation, L as JsonSchema7TupleType, M as JsonSchema7RecordPropertyNamesType, N as JsonSchema7RecordType, O as JsonSchema7ObjectType, P as JsonSchema7RefType, Q as Tree, R as JsonSchema7Type, S as JsonSchema7Meta, T as JsonSchema7NullType, U as JsonSerializeOptions, V as JsonSchema7UnionType, W as JsonValue, X as SimpleTypeAnnotation, Y as SerializableJsonValue, Z as SymbolTypeAnnotation, _ as JsonSchema7BooleanType, a as CustomTypeAnnotation, b as JsonSchema7LiteralType, c as JsonObject, d as JsonParserResult, et as TypedArrayAnnotation, f as JsonSchema7AllOfType, g as JsonSchema7BigintType, h as JsonSchema7ArrayType, i as CompositeTypeAnnotation, j as JsonSchema7PrimitiveUnionType, k as JsonSchema7Primitive, l as JsonParseOptions, m as JsonSchema7AnyType, n as ClassInstance, o as InnerNode, p as JsonSchema7AnyOfType, q as PrimitiveJsonValue, r as ClassTypeAnnotation, s as JsonArray, t as Class, u as JsonParserInterface, v as JsonSchema7DateType, w as JsonSchema7NeverType, x as JsonSchema7MapType, y as JsonSchema7EnumType, z as JsonSchema7TypeUnion } from "./types-CPQlxauZ.mjs";
|
|
4
|
+
import { a as isJsonSchema7PrimitiveLiteralType, i as isJsonSchema7ObjectType, n as isJsonSchema7ArrayType, o as isStandardJsonSchema, r as isJsonSchema7LiteralType, t as isJsonSchema7AllOfType } from "./schema-CmH1V_uI.mjs";
|
|
5
|
+
import { t as StormJSON } from "./storm-json-8F9CKpXu.mjs";
|
|
6
|
+
import { t as codeFrameColumns } from "./code-frames-CrTAYYSE.mjs";
|
|
7
|
+
import { n as parse, r as safeParse, t as Options } from "./parse-fXy5pbmE.mjs";
|
|
8
|
+
import { t as formatParseError } from "./parse-error-DpEv3vo_.mjs";
|
|
9
|
+
import { n as stringify, t as invalidKeyChars } from "./stringify-CFT1K1LE.mjs";
|
|
10
|
+
import { t as stripComments } from "./strip-comments-BA8MS_Fs.mjs";
|
|
11
|
+
import "./index-CCt0lwyI.mjs";
|
|
12
|
+
export { ArrayReference, Class, ClassInstance, ClassTypeAnnotation, CompositeTypeAnnotation, CustomTypeAnnotation, InnerNode, JsonArray, JsonObject, JsonParseOptions, JsonParserInterface, JsonParserResult, JsonSchema7AllOfType, JsonSchema7AnyOfType, JsonSchema7AnyType, JsonSchema7ArrayType, JsonSchema7BigintType, JsonSchema7BooleanType, JsonSchema7DateType, JsonSchema7EnumType, JsonSchema7LiteralType, JsonSchema7MapType, JsonSchema7Meta, JsonSchema7NativeEnumType, JsonSchema7NeverType, JsonSchema7NullType, JsonSchema7NullableType, JsonSchema7NumberType, JsonSchema7ObjectType, JsonSchema7Primitive, JsonSchema7PrimitiveLiteralType, JsonSchema7PrimitiveUnionType, JsonSchema7RecordPropertyNamesType, JsonSchema7RecordType, JsonSchema7RefType, JsonSchema7SetType, JsonSchema7StringType, JsonSchema7TupleType, JsonSchema7Type, JsonSchema7TypeUnion, JsonSchema7UndefinedType, JsonSchema7UnionType, JsonSchema7UnknownType, JsonSerializeOptions, JsonValue, Leaf, LeafTypeAnnotation, ObjectReference, Options, PrimitiveJsonValue, PrimitiveTypeAnnotation, Reference, SerializableJsonValue, SimpleTypeAnnotation, StormJSON, SymbolTypeAnnotation, Tree, TypeAnnotation, TypedArrayAnnotation, codeFrameColumns, escapePointerSegment, find, formatJsonPointer, formatParseError, invalidKeyChars, isArrayEnd, isArrayReference, isInteger, isJsonSchema7AllOfType, isJsonSchema7ArrayType, isJsonSchema7LiteralType, isJsonSchema7ObjectType, isJsonSchema7PrimitiveLiteralType, isObjectReference, isRoot, isStandardJsonSchema, isValidIndex, parent, parse, parseJsonPointer, safeParse, stringify, stripComments, unescapePointerSegment };
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import "./
|
|
1
|
+
import { i as isObjectReference, n as isArrayEnd, r as isArrayReference, t as find } from "./find-reference-DMSYEaaI.mjs";
|
|
2
|
+
import { a as isValidIndex, c as unescapePointerSegment, i as isRoot, n as formatJsonPointer, o as parent, r as isInteger, s as parseJsonPointer, t as escapePointerSegment } from "./parse-vw_qRD3F.mjs";
|
|
3
|
+
import "./pointer-Dn__XOdY.mjs";
|
|
4
|
+
import { a as isJsonSchema7PrimitiveLiteralType, i as isJsonSchema7ObjectType, n as isJsonSchema7ArrayType, o as isStandardJsonSchema, r as isJsonSchema7LiteralType, t as isJsonSchema7AllOfType } from "./schema-DGmzxHja.mjs";
|
|
5
|
+
import { t as stripComments } from "./strip-comments-Dq00N_Sg.mjs";
|
|
6
|
+
import { n as safeParse, t as parse } from "./parse-Dn43ZK9y.mjs";
|
|
7
|
+
import { t as codeFrameColumns } from "./code-frames-DuBfTMu4.mjs";
|
|
8
|
+
import { t as formatParseError } from "./parse-error-Af4zHUQ_.mjs";
|
|
9
|
+
import { n as stringify, t as invalidKeyChars } from "./stringify-CYHjAvWm.mjs";
|
|
10
|
+
import { t as StormJSON } from "./storm-json-nkhJgTz4.mjs";
|
|
11
|
+
import "./types.mjs";
|
|
12
|
+
import "./utils-mEkKIcgl.mjs";
|
|
8
13
|
|
|
9
|
-
export { StormJSON, codeFrameColumns, formatParseError, invalidKeyChars, parse, safeParse, stringify, stripComments };
|
|
14
|
+
export { StormJSON, codeFrameColumns, escapePointerSegment, find, formatJsonPointer, formatParseError, invalidKeyChars, isArrayEnd, isArrayReference, isInteger, isJsonSchema7AllOfType, isJsonSchema7ArrayType, isJsonSchema7LiteralType, isJsonSchema7ObjectType, isJsonSchema7PrimitiveLiteralType, isObjectReference, isRoot, isStandardJsonSchema, isValidIndex, parent, parse, parseJsonPointer, safeParse, stringify, stripComments, unescapePointerSegment };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region ../type-checks/src/get-object-tag.ts
|
|
2
|
+
/**
|
|
3
|
+
* Gets the `toStringTag` of `obj`.
|
|
4
|
+
*
|
|
5
|
+
* @param value - The obj to query.
|
|
6
|
+
* @returns Returns the `toStringTag`.
|
|
7
|
+
*/
|
|
8
|
+
const getObjectTag = (value) => {
|
|
9
|
+
if (value == null) return value === void 0 ? "[object Undefined]" : "[object Null]";
|
|
10
|
+
return Object.prototype.toString.call(value);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region ../type-checks/src/is-number.ts
|
|
15
|
+
/**
|
|
16
|
+
* Check if the provided value's type is `number`
|
|
17
|
+
*
|
|
18
|
+
* @param value - The value to type check
|
|
19
|
+
* @returns An indicator specifying if the value provided is of type `number`
|
|
20
|
+
*/
|
|
21
|
+
const isNumber = (value) => {
|
|
22
|
+
try {
|
|
23
|
+
return value instanceof Number || typeof value === "number" || Number(value) === value;
|
|
24
|
+
} catch {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
export { getObjectTag as n, isNumber as t };
|
|
31
|
+
//# sourceMappingURL=is-number-BIwzZzyi.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-number-BIwzZzyi.mjs","names":[],"sources":["../../type-checks/src/get-object-tag.ts","../../type-checks/src/is-number.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Gets the `toStringTag` of `obj`.\n *\n * @param value - The obj to query.\n * @returns Returns the `toStringTag`.\n */\nexport const getObjectTag = (value: unknown): string => {\n if (value == null) {\n return value === undefined ? \"[object Undefined]\" : \"[object Null]\";\n }\n return Object.prototype.toString.call(value);\n};\n","/* -------------------------------------------------------------------\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":";;;;;;;AAwBA,MAAa,gBAAgB,UAA2B;AACtD,KAAI,SAAS,KACX,QAAO,UAAU,SAAY,uBAAuB;AAEtD,QAAO,OAAO,UAAU,SAAS,KAAK,MAAM;;;;;;;;;;;ACD9C,MAAa,YAAY,UAAoC;AAC3D,KAAI;AACF,SACE,iBAAiB,UACjB,OAAO,UAAU,YACjB,OAAO,MAAM,KAAK;SAEd;AACN,SAAO"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
|
|
2
|
+
//#region ../type-checks/src/get-object-tag.ts
|
|
3
|
+
/**
|
|
4
|
+
* Gets the `toStringTag` of `obj`.
|
|
5
|
+
*
|
|
6
|
+
* @param value - The obj to query.
|
|
7
|
+
* @returns Returns the `toStringTag`.
|
|
8
|
+
*/
|
|
9
|
+
const getObjectTag = (value) => {
|
|
10
|
+
if (value == null) return value === void 0 ? "[object Undefined]" : "[object Null]";
|
|
11
|
+
return Object.prototype.toString.call(value);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region ../type-checks/src/is-number.ts
|
|
16
|
+
/**
|
|
17
|
+
* Check if the provided value's type is `number`
|
|
18
|
+
*
|
|
19
|
+
* @param value - The value to type check
|
|
20
|
+
* @returns An indicator specifying if the value provided is of type `number`
|
|
21
|
+
*/
|
|
22
|
+
const isNumber = (value) => {
|
|
23
|
+
try {
|
|
24
|
+
return value instanceof Number || typeof value === "number" || Number(value) === value;
|
|
25
|
+
} catch {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
Object.defineProperty(exports, 'getObjectTag', {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () {
|
|
34
|
+
return getObjectTag;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, 'isNumber', {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () {
|
|
40
|
+
return isNumber;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getObjectTag } from "./
|
|
1
|
+
import { n as getObjectTag } from "./is-number-BIwzZzyi.mjs";
|
|
2
2
|
|
|
3
3
|
//#region ../type-checks/src/is-plain-object.ts
|
|
4
4
|
/**
|
|
@@ -60,5 +60,21 @@ const isPlainObject = (obj) => {
|
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
//#endregion
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
//#region ../type-checks/src/is-object.ts
|
|
64
|
+
/**
|
|
65
|
+
* Check if the provided value's type is `Object`
|
|
66
|
+
*
|
|
67
|
+
* @param value - The value to type check
|
|
68
|
+
* @returns An indicator specifying if the value provided is of type `Object`
|
|
69
|
+
*/
|
|
70
|
+
const isObject = (value) => {
|
|
71
|
+
try {
|
|
72
|
+
return typeof value === "object" || Boolean(value) && value?.constructor === Object || isPlainObject(value);
|
|
73
|
+
} catch {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
//#endregion
|
|
79
|
+
export { isObject as t };
|
|
80
|
+
//# sourceMappingURL=is-object-BpfmzHWa.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-object-BpfmzHWa.mjs","names":[],"sources":["../../type-checks/src/is-plain-object.ts","../../type-checks/src/is-object.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { PlainObject } from \"@stryke/types/base\";\nimport { getObjectTag } from \"./get-object-tag\";\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @example\n * ```typescript\n * isObjectLike({})\n * // => true\n *\n * isObjectLike([1, 2, 3])\n * // => true\n *\n * isObjectLike(Function)\n * // => false\n *\n * isObjectLike(null)\n * // => false\n * ```\n *\n * @param value - The value to check.\n * @returns Returns `true` if `value` is object-like, else `false`.\n */\nexport const isObjectLike = (obj: unknown) => {\n return typeof obj === \"object\" && obj !== null;\n};\n\n/**\n * Checks if `obj` is a plain object, that is, an object created by the `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @example\n * ```typescript\n * function Foo() {\n * this.a = 1\n * }\n *\n * isPlainObject(new Foo)\n * // => false\n *\n * isPlainObject([1, 2, 3])\n * // => false\n *\n * isPlainObject({ 'x': 0, 'y': 0 })\n * // => true\n *\n * isPlainObject(Object.create(null))\n * // => true\n * ```\n *\n * @param obj - The value to check.\n * @returns Returns `true` if `obj` is a plain object, else `false`.\n */\nexport const isPlainObject = (obj: unknown): obj is PlainObject => {\n if (!isObjectLike(obj) || getObjectTag(obj) !== \"[object Object]\") {\n return false;\n }\n if (Object.getPrototypeOf(obj) === null) {\n return true;\n }\n let proto = obj;\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n return Object.getPrototypeOf(obj) === proto;\n};\n","/* -------------------------------------------------------------------\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":";;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAa,gBAAgB,QAAiB;AAC5C,QAAO,OAAO,QAAQ,YAAY,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4B5C,MAAa,iBAAiB,QAAqC;AACjE,KAAI,CAAC,aAAa,IAAI,IAAI,aAAa,IAAI,KAAK,kBAC9C,QAAO;AAET,KAAI,OAAO,eAAe,IAAI,KAAK,KACjC,QAAO;CAET,IAAI,QAAQ;AACZ,QAAO,OAAO,eAAe,MAAM,KAAK,KACtC,SAAQ,OAAO,eAAe,MAAM;AAEtC,QAAO,OAAO,eAAe,IAAI,KAAK;;;;;;;;;;;ACVxC,MAAa,YAAY,UAAoC;AAC3D,KAAI;AACF,SACE,OAAO,UAAU,YAChB,QAAQ,MAAM,IAAI,OAAO,gBAAgB,UAC1C,cAAc,MAAM;SAEhB;AACN,SAAO"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_is_number = require('./is-number-c5xguIbS.cjs');
|
|
2
2
|
|
|
3
3
|
//#region ../type-checks/src/is-plain-object.ts
|
|
4
4
|
/**
|
|
@@ -52,7 +52,7 @@ const isObjectLike = (obj) => {
|
|
|
52
52
|
* @returns Returns `true` if `obj` is a plain object, else `false`.
|
|
53
53
|
*/
|
|
54
54
|
const isPlainObject = (obj) => {
|
|
55
|
-
if (!isObjectLike(obj) ||
|
|
55
|
+
if (!isObjectLike(obj) || require_is_number.getObjectTag(obj) !== "[object Object]") return false;
|
|
56
56
|
if (Object.getPrototypeOf(obj) === null) return true;
|
|
57
57
|
let proto = obj;
|
|
58
58
|
while (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto);
|
|
@@ -60,4 +60,25 @@ const isPlainObject = (obj) => {
|
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
//#endregion
|
|
63
|
-
|
|
63
|
+
//#region ../type-checks/src/is-object.ts
|
|
64
|
+
/**
|
|
65
|
+
* Check if the provided value's type is `Object`
|
|
66
|
+
*
|
|
67
|
+
* @param value - The value to type check
|
|
68
|
+
* @returns An indicator specifying if the value provided is of type `Object`
|
|
69
|
+
*/
|
|
70
|
+
const isObject = (value) => {
|
|
71
|
+
try {
|
|
72
|
+
return typeof value === "object" || Boolean(value) && value?.constructor === Object || isPlainObject(value);
|
|
73
|
+
} catch {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
//#endregion
|
|
79
|
+
Object.defineProperty(exports, 'isObject', {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
get: function () {
|
|
82
|
+
return isObject;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
const require_is_number = require('./is-number-c5xguIbS.cjs');
|
|
2
|
+
const require_is_object = require('./is-object-umGh91v1.cjs');
|
|
3
|
+
const require_is_undefined = require('./is-undefined-CnI0qe-z.cjs');
|
|
4
|
+
|
|
5
|
+
//#region ../type-checks/src/is-function.ts
|
|
6
|
+
function isSyncFunction(value) {
|
|
7
|
+
return require_is_number.getObjectTag(value) === "[object Function]";
|
|
8
|
+
}
|
|
9
|
+
function isAsyncFunction(value) {
|
|
10
|
+
return require_is_number.getObjectTag(value) === "[object AsyncFunction]";
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Check if the provided value's type is `Function`
|
|
14
|
+
*
|
|
15
|
+
* @param value - The value to type check
|
|
16
|
+
* @returns An indicator specifying if the value provided is of type `Function`
|
|
17
|
+
*/
|
|
18
|
+
const isFunction = (value) => {
|
|
19
|
+
try {
|
|
20
|
+
return value instanceof Function || typeof value === "function" || Boolean(value?.constructor && value?.call && value?.apply) || isSyncFunction(value) || isAsyncFunction(value);
|
|
21
|
+
} catch {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region ../type-checks/src/is-null.ts
|
|
28
|
+
const isNull = (value) => {
|
|
29
|
+
try {
|
|
30
|
+
return value === null;
|
|
31
|
+
} catch {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region ../type-checks/src/is-empty.ts
|
|
38
|
+
/**
|
|
39
|
+
* Check if the provided value's type is `null` or `undefined`
|
|
40
|
+
*
|
|
41
|
+
* @param value - The value to type check
|
|
42
|
+
* @returns An indicator specifying if the value provided is of type `null` or `undefined`
|
|
43
|
+
*/
|
|
44
|
+
const isEmpty = (value) => {
|
|
45
|
+
try {
|
|
46
|
+
return require_is_undefined.isUndefined(value) || isNull(value);
|
|
47
|
+
} catch {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region ../type-checks/src/is-set.ts
|
|
54
|
+
/**
|
|
55
|
+
* The inverse of the `isEmpty` function
|
|
56
|
+
*
|
|
57
|
+
* @param value - The value to type check
|
|
58
|
+
* @returns An indicator specifying if the value provided is **NOT** of type `null` or `undefined`
|
|
59
|
+
*/
|
|
60
|
+
const isSet = (value) => {
|
|
61
|
+
try {
|
|
62
|
+
return !isEmpty(value);
|
|
63
|
+
} catch {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region ../type-checks/src/is-non-null-object.ts
|
|
70
|
+
/**
|
|
71
|
+
* Check if the provided value's type is `Object` and is not `null` or `undefined`
|
|
72
|
+
*
|
|
73
|
+
* @param value - The value to type check
|
|
74
|
+
* @returns An indicator specifying if the value provided is of type `Object` and is not `null` or `undefined`
|
|
75
|
+
*/
|
|
76
|
+
const isNonNullObject = (value) => {
|
|
77
|
+
return isSet(value) && require_is_object.isObject(value);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region ../type-checks/src/is-set-object.ts
|
|
82
|
+
/**
|
|
83
|
+
* Check if the provided value's type is an object with some fields set
|
|
84
|
+
*
|
|
85
|
+
* @param value - The value to type check
|
|
86
|
+
* @returns An indicator specifying if the value provided is an object with some fields se
|
|
87
|
+
*/
|
|
88
|
+
const isSetObject = (value) => {
|
|
89
|
+
try {
|
|
90
|
+
return isNonNullObject(value) && Object.keys(value).length > 0;
|
|
91
|
+
} catch {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
97
|
+
Object.defineProperty(exports, 'isFunction', {
|
|
98
|
+
enumerable: true,
|
|
99
|
+
get: function () {
|
|
100
|
+
return isFunction;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
Object.defineProperty(exports, 'isSetObject', {
|
|
104
|
+
enumerable: true,
|
|
105
|
+
get: function () {
|
|
106
|
+
return isSetObject;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { n as getObjectTag } from "./is-number-BIwzZzyi.mjs";
|
|
2
|
+
import { t as isObject } from "./is-object-BpfmzHWa.mjs";
|
|
3
|
+
import { t as isUndefined } from "./is-undefined-CmyJWYGD.mjs";
|
|
4
|
+
|
|
5
|
+
//#region ../type-checks/src/is-function.ts
|
|
6
|
+
function isSyncFunction(value) {
|
|
7
|
+
return getObjectTag(value) === "[object Function]";
|
|
8
|
+
}
|
|
9
|
+
function isAsyncFunction(value) {
|
|
10
|
+
return getObjectTag(value) === "[object AsyncFunction]";
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Check if the provided value's type is `Function`
|
|
14
|
+
*
|
|
15
|
+
* @param value - The value to type check
|
|
16
|
+
* @returns An indicator specifying if the value provided is of type `Function`
|
|
17
|
+
*/
|
|
18
|
+
const isFunction = (value) => {
|
|
19
|
+
try {
|
|
20
|
+
return value instanceof Function || typeof value === "function" || Boolean(value?.constructor && value?.call && value?.apply) || isSyncFunction(value) || isAsyncFunction(value);
|
|
21
|
+
} catch {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region ../type-checks/src/is-null.ts
|
|
28
|
+
const isNull = (value) => {
|
|
29
|
+
try {
|
|
30
|
+
return value === null;
|
|
31
|
+
} catch {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region ../type-checks/src/is-empty.ts
|
|
38
|
+
/**
|
|
39
|
+
* Check if the provided value's type is `null` or `undefined`
|
|
40
|
+
*
|
|
41
|
+
* @param value - The value to type check
|
|
42
|
+
* @returns An indicator specifying if the value provided is of type `null` or `undefined`
|
|
43
|
+
*/
|
|
44
|
+
const isEmpty = (value) => {
|
|
45
|
+
try {
|
|
46
|
+
return isUndefined(value) || isNull(value);
|
|
47
|
+
} catch {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region ../type-checks/src/is-set.ts
|
|
54
|
+
/**
|
|
55
|
+
* The inverse of the `isEmpty` function
|
|
56
|
+
*
|
|
57
|
+
* @param value - The value to type check
|
|
58
|
+
* @returns An indicator specifying if the value provided is **NOT** of type `null` or `undefined`
|
|
59
|
+
*/
|
|
60
|
+
const isSet = (value) => {
|
|
61
|
+
try {
|
|
62
|
+
return !isEmpty(value);
|
|
63
|
+
} catch {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region ../type-checks/src/is-non-null-object.ts
|
|
70
|
+
/**
|
|
71
|
+
* Check if the provided value's type is `Object` and is not `null` or `undefined`
|
|
72
|
+
*
|
|
73
|
+
* @param value - The value to type check
|
|
74
|
+
* @returns An indicator specifying if the value provided is of type `Object` and is not `null` or `undefined`
|
|
75
|
+
*/
|
|
76
|
+
const isNonNullObject = (value) => {
|
|
77
|
+
return isSet(value) && isObject(value);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region ../type-checks/src/is-set-object.ts
|
|
82
|
+
/**
|
|
83
|
+
* Check if the provided value's type is an object with some fields set
|
|
84
|
+
*
|
|
85
|
+
* @param value - The value to type check
|
|
86
|
+
* @returns An indicator specifying if the value provided is an object with some fields se
|
|
87
|
+
*/
|
|
88
|
+
const isSetObject = (value) => {
|
|
89
|
+
try {
|
|
90
|
+
return isNonNullObject(value) && Object.keys(value).length > 0;
|
|
91
|
+
} catch {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
97
|
+
export { isFunction as n, isSetObject as t };
|
|
98
|
+
//# sourceMappingURL=is-set-object-C1Qnj1Q8.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-set-object-C1Qnj1Q8.mjs","names":[],"sources":["../../type-checks/src/is-function.ts","../../type-checks/src/is-null.ts","../../type-checks/src/is-empty.ts","../../type-checks/src/is-set.ts","../../type-checks/src/is-non-null-object.ts","../../type-checks/src/is-set-object.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport 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","/* -------------------------------------------------------------------\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","/* -------------------------------------------------------------------\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","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isEmpty } from \"./is-empty\";\n\n/**\n * The inverse of the `isEmpty` function\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is **NOT** of type `null` or `undefined`\n */\nexport const isSet = (value: unknown): value is NonNullable<unknown> => {\n try {\n return !isEmpty(value);\n } catch {\n return false;\n }\n};\n","/* -------------------------------------------------------------------\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","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isNonNullObject } from \"./is-non-null-object\";\n\n/**\n * Check if the provided value's type is an object with some fields set\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is an object with some fields se\n */\nexport const isSetObject = (value: unknown): value is NonNullable<object> => {\n try {\n return isNonNullObject(value) && Object.keys(value).length > 0;\n } catch {\n return false;\n }\n};\n"],"mappings":";;;;;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;;;;;;AC7BX,MAAa,UAAU,UAAkC;AACvD,KAAI;AACF,SAAO,UAAU;SACX;AACN,SAAO;;;;;;;;;;;;ACSX,MAAa,WAAW,UAAmB;AACzC,KAAI;AACF,SAAO,YAAY,MAAM,IAAI,OAAO,MAAM;SACpC;AACN,SAAO;;;;;;;;;;;;ACTX,MAAa,SAAS,UAAkD;AACtE,KAAI;AACF,SAAO,CAAC,QAAQ,MAAM;SAChB;AACN,SAAO;;;;;;;;;;;;ACHX,MAAa,mBAAmB,UAA6C;AAC3E,QAAO,MAAM,MAAM,IAAI,SAAS,MAAM;;;;;;;;;;;ACFxC,MAAa,eAAe,UAAiD;AAC3E,KAAI;AACF,SAAO,gBAAgB,MAAM,IAAI,OAAO,KAAK,MAAM,CAAC,SAAS;SACvD;AACN,SAAO"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
//#region ../type-checks/src/is-string.ts
|
|
2
3
|
const isString = (value) => {
|
|
3
4
|
try {
|
|
@@ -8,5 +9,9 @@ const isString = (value) => {
|
|
|
8
9
|
};
|
|
9
10
|
|
|
10
11
|
//#endregion
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
Object.defineProperty(exports, 'isString', {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return isString;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
//#region ../type-checks/src/is-string.ts
|
|
3
2
|
const isString = (value) => {
|
|
4
3
|
try {
|
|
@@ -9,4 +8,5 @@ const isString = (value) => {
|
|
|
9
8
|
};
|
|
10
9
|
|
|
11
10
|
//#endregion
|
|
12
|
-
|
|
11
|
+
export { isString as t };
|
|
12
|
+
//# sourceMappingURL=is-string-CLiBUSKV.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-string-CLiBUSKV.mjs","names":[],"sources":["../../type-checks/src/is-string.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const isString = (value: unknown): value is string => {\n try {\n return typeof value === \"string\";\n } catch {\n return false;\n }\n};\n"],"mappings":";AAkBA,MAAa,YAAY,UAAoC;AAC3D,KAAI;AACF,SAAO,OAAO,UAAU;SAClB;AACN,SAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-undefined-CmyJWYGD.mjs","names":[],"sources":["../../type-checks/src/is-undefined.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const isUndefined = (value: unknown): value is undefined => {\n return value === undefined;\n};\n"],"mappings":";AAkBA,MAAa,eAAe,UAAuC;AACjE,QAAO,UAAU"}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
|
|
1
2
|
//#region ../type-checks/src/is-undefined.ts
|
|
2
3
|
const isUndefined = (value) => {
|
|
3
4
|
return value === void 0;
|
|
4
5
|
};
|
|
5
6
|
|
|
6
7
|
//#endregion
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
Object.defineProperty(exports, 'isUndefined', {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () {
|
|
11
|
+
return isUndefined;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/utils/parse.d.ts
|
|
2
|
+
interface Options {
|
|
3
|
+
strict?: boolean;
|
|
4
|
+
}
|
|
5
|
+
declare function parse<T = unknown>(value: any, options?: Options): T;
|
|
6
|
+
declare function safeParse<T = unknown>(value: any, options?: Options): T;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { parse as n, safeParse as r, Options as t };
|
|
9
|
+
//# sourceMappingURL=parse-BGlhbY16.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-BGlhbY16.d.cts","names":[],"sources":["../src/utils/parse.ts"],"sourcesContent":[],"mappings":";UA4CiB,OAAA;EAAA,MAAA,CAAA,EAAA,OAAO;AAIxB;AAmEgB,iBAnEA,KAmE4C,CAAA,IAAA,OAAgB,CAAA,CAAA,KAAA,EAAA,GAAA,EAAA,OAAA,CAAA,EAnEpB,OAmEoB,CAAA,EAnEL,CAmEK;iBAA5D,6CAA4C,UAAe"}
|