@stryke/json 0.11.0 → 0.13.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 +25 -0
- package/dist/canonical-3PQxSh5G.d.cts +17 -0
- package/dist/canonical-3PQxSh5G.d.cts.map +1 -0
- package/dist/canonical-CVbmCnGM.mjs +28 -0
- package/dist/canonical-CVbmCnGM.mjs.map +1 -0
- package/dist/canonical-DZDrZ9dv.d.mts +17 -0
- package/dist/canonical-DZDrZ9dv.d.mts.map +1 -0
- package/dist/canonical-hMXtzPIV.cjs +33 -0
- package/dist/canonical.cjs +3 -0
- package/dist/canonical.d.cts +2 -0
- package/dist/canonical.d.mts +2 -0
- package/dist/canonical.mjs +3 -0
- package/dist/{code-frames-BUtrssZ5.d.cts → code-frames-BOS_tt9F.d.mts} +1 -1
- package/dist/{code-frames-CrTAYYSE.d.mts.map → code-frames-BOS_tt9F.d.mts.map} +1 -1
- package/dist/{code-frames-DuBfTMu4.mjs → code-frames-C8DEdLmV.mjs} +1 -1
- package/dist/{code-frames-DuBfTMu4.mjs.map → code-frames-C8DEdLmV.mjs.map} +1 -1
- package/dist/{code-frames-CrTAYYSE.d.mts → code-frames-ClyQ9O1l.d.cts} +1 -1
- package/dist/{code-frames-BUtrssZ5.d.cts.map → code-frames-ClyQ9O1l.d.cts.map} +1 -1
- package/dist/{find-reference-B8xshNXL.d.mts → find-reference-BuuNqqOh.d.cts} +1 -1
- package/dist/{find-reference-B8xshNXL.d.mts.map → find-reference-BuuNqqOh.d.cts.map} +1 -1
- package/dist/{find-reference-De5vBQV2.cjs → find-reference-Ct8UDBo2.cjs} +2 -2
- package/dist/{find-reference-C-YleCds.d.cts → find-reference-MHRH7HJ_.d.mts} +1 -1
- package/dist/{find-reference-C-YleCds.d.cts.map → find-reference-MHRH7HJ_.d.mts.map} +1 -1
- package/dist/{find-reference-DMSYEaaI.mjs → find-reference-kPgdulJ1.mjs} +3 -3
- package/dist/{find-reference-DMSYEaaI.mjs.map → find-reference-kPgdulJ1.mjs.map} +1 -1
- package/dist/index.cjs +17 -11
- package/dist/index.d.cts +12 -11
- package/dist/index.d.mts +13 -12
- package/dist/index.mjs +13 -12
- package/dist/{is-number-BIwzZzyi.mjs → is-number-BMxmACAS.mjs} +1 -1
- package/dist/{is-number-BIwzZzyi.mjs.map → is-number-BMxmACAS.mjs.map} +1 -1
- package/dist/{is-object-BpfmzHWa.mjs → is-object-BYxzKTYU.mjs} +2 -2
- package/dist/{is-object-BpfmzHWa.mjs.map → is-object-BYxzKTYU.mjs.map} +1 -1
- package/dist/{is-object-umGh91v1.cjs → is-object-BbRMEXAo.cjs} +1 -1
- package/dist/{is-set-object-BmHip9em.cjs → is-set-object-5lZPw_Pq.cjs} +3 -3
- package/dist/{is-set-object-C1Qnj1Q8.mjs → is-set-object-yxjp5vg-.mjs} +4 -4
- package/dist/{is-set-object-C1Qnj1Q8.mjs.map → is-set-object-yxjp5vg-.mjs.map} +1 -1
- package/dist/{is-string-CLiBUSKV.mjs → is-string--ny35huw.mjs} +1 -1
- package/dist/{is-string-CLiBUSKV.mjs.map → is-string--ny35huw.mjs.map} +1 -1
- package/dist/{is-undefined-CmyJWYGD.mjs → is-undefined-CqNzBssC.mjs} +1 -1
- package/dist/{is-undefined-CmyJWYGD.mjs.map → is-undefined-CqNzBssC.mjs.map} +1 -1
- package/dist/{parse-vw_qRD3F.mjs → parse-B3NfTO06.mjs} +3 -3
- package/dist/{parse-vw_qRD3F.mjs.map → parse-B3NfTO06.mjs.map} +1 -1
- package/dist/{parse-Bp6kkcQ4.cjs → parse-BSmqrTy_.cjs} +2 -2
- package/dist/{parse-Dn43ZK9y.mjs → parse-BrChHTWb.mjs} +2 -2
- package/dist/{parse-Dn43ZK9y.mjs.map → parse-BrChHTWb.mjs.map} +1 -1
- package/dist/{parse-ByDxRup5.cjs → parse-CX9jPskm.cjs} +1 -1
- package/dist/{parse-DZfi3d96.d.cts → parse-DCHSu_0u.d.cts} +1 -1
- package/dist/{parse-Cj-YfhrI.d.mts.map → parse-DCHSu_0u.d.cts.map} +1 -1
- package/dist/{parse-Cj-YfhrI.d.mts → parse-DaiwKCLz.d.mts} +1 -1
- package/dist/{parse-DZfi3d96.d.cts.map → parse-DaiwKCLz.d.mts.map} +1 -1
- package/dist/{parse-BGlhbY16.d.cts → parse-XXQfTfNE.d.mts} +1 -1
- package/dist/{parse-BGlhbY16.d.cts.map → parse-XXQfTfNE.d.mts.map} +1 -1
- package/dist/{parse-error-DpEv3vo_.d.mts → parse-error-CDt01Gvc.d.mts} +1 -1
- package/dist/parse-error-CDt01Gvc.d.mts.map +1 -0
- package/dist/{parse-error-7K8s4vWf.d.cts → parse-error-CGKcBkMJ.d.cts} +1 -1
- package/dist/parse-error-CGKcBkMJ.d.cts.map +1 -0
- package/dist/{parse-error-N7UE-HMh.cjs → parse-error-CUOf-YBA.cjs} +2 -2
- package/dist/{parse-error-Af4zHUQ_.mjs → parse-error-Cu6mjBS7.mjs} +2 -2
- package/dist/{parse-error-Af4zHUQ_.mjs.map → parse-error-Cu6mjBS7.mjs.map} +1 -1
- package/dist/{parse-fXy5pbmE.d.mts → parse-ygKFNauQ.d.cts} +1 -1
- package/dist/{parse-fXy5pbmE.d.mts.map → parse-ygKFNauQ.d.cts.map} +1 -1
- package/dist/pointer/find-reference.cjs +1 -1
- package/dist/pointer/find-reference.d.cts +1 -1
- package/dist/pointer/find-reference.d.mts +1 -1
- package/dist/pointer/find-reference.mjs +1 -1
- package/dist/pointer/index.cjs +3 -3
- package/dist/pointer/index.d.cts +2 -2
- package/dist/pointer/index.d.mts +2 -2
- package/dist/pointer/index.mjs +3 -3
- package/dist/pointer/parse.cjs +1 -1
- package/dist/pointer/parse.d.cts +1 -1
- package/dist/pointer/parse.d.mts +1 -1
- package/dist/pointer/parse.mjs +1 -1
- package/dist/{schema-DGmzxHja.mjs → schema-CMt54x11.mjs} +39 -3
- package/dist/schema-CMt54x11.mjs.map +1 -0
- package/dist/{schema-BO1HCrxv.d.cts → schema-CuBX00tF.d.cts} +33 -5
- package/dist/schema-CuBX00tF.d.cts.map +1 -0
- package/dist/{schema-Dl018Aq4.cjs → schema-CwyRhvHe.cjs} +61 -1
- package/dist/{schema-CmH1V_uI.d.mts → schema-D5wPTiM4.d.mts} +33 -5
- package/dist/schema-D5wPTiM4.d.mts.map +1 -0
- package/dist/schema.cjs +5 -1
- package/dist/schema.d.cts +2 -2
- package/dist/schema.d.mts +3 -3
- package/dist/schema.mjs +2 -2
- package/dist/{storm-json-BD6WFbrI.cjs → storm-json-BDPXNC_u.cjs} +5 -5
- package/dist/{storm-json-nkhJgTz4.mjs → storm-json-BmO91crX.mjs} +6 -6
- package/dist/{storm-json-nkhJgTz4.mjs.map → storm-json-BmO91crX.mjs.map} +1 -1
- package/dist/{storm-json-8F9CKpXu.d.mts → storm-json-DJwb3Ou-.d.mts} +2 -2
- package/dist/{storm-json-8F9CKpXu.d.mts.map → storm-json-DJwb3Ou-.d.mts.map} +1 -1
- package/dist/{storm-json-DvIEWMEH.d.cts → storm-json-DiBg5b6r.d.cts} +2 -2
- package/dist/{storm-json-DvIEWMEH.d.cts.map → storm-json-DiBg5b6r.d.cts.map} +1 -1
- package/dist/storm-json.cjs +2 -2
- package/dist/storm-json.d.cts +1 -1
- package/dist/storm-json.d.mts +2 -2
- package/dist/storm-json.mjs +2 -2
- package/dist/{stringify-CYHjAvWm.mjs → stringify-CfeAVjh8.mjs} +3 -3
- package/dist/{stringify-CYHjAvWm.mjs.map → stringify-CfeAVjh8.mjs.map} +1 -1
- package/dist/{stringify-BehjrfhS.cjs → stringify-DQOBApRO.cjs} +2 -2
- package/dist/{stringify-Bc8OkhIr.d.cts → stringify-DtMcg2Wy.d.mts} +1 -1
- package/dist/stringify-DtMcg2Wy.d.mts.map +1 -0
- package/dist/{stringify-CFT1K1LE.d.mts → stringify-mAxwby9q.d.cts} +1 -1
- package/dist/stringify-mAxwby9q.d.cts.map +1 -0
- package/dist/{strip-comments-BA8MS_Fs.d.mts → strip-comments-AOXnoydB.d.cts} +1 -1
- package/dist/{strip-comments-BA8MS_Fs.d.mts.map → strip-comments-AOXnoydB.d.cts.map} +1 -1
- package/dist/{strip-comments-Cz_Wc25t.d.cts → strip-comments-BNN6Uf4e.d.mts} +1 -1
- package/dist/{strip-comments-Cz_Wc25t.d.cts.map → strip-comments-BNN6Uf4e.d.mts.map} +1 -1
- package/dist/{strip-comments-Dq00N_Sg.mjs → strip-comments-DNTu6CWM.mjs} +1 -1
- package/dist/{strip-comments-Dq00N_Sg.mjs.map → strip-comments-DNTu6CWM.mjs.map} +1 -1
- package/dist/{types-CPQlxauZ.d.mts → types-BAtAPir9.d.mts} +1 -1
- package/dist/{types-Bn8rC098.d.cts.map → types-BAtAPir9.d.mts.map} +1 -1
- package/dist/{types-Bn8rC098.d.cts → types-BzNIRhpI.d.cts} +1 -1
- package/dist/{types-CPQlxauZ.d.mts.map → types-BzNIRhpI.d.cts.map} +1 -1
- package/dist/types.d.cts +1 -1
- package/dist/types.d.mts +1 -1
- package/dist/utils/code-frames.cjs +1 -1
- package/dist/utils/code-frames.d.cts +1 -1
- package/dist/utils/code-frames.d.mts +1 -1
- package/dist/utils/code-frames.mjs +1 -1
- package/dist/utils/index.cjs +6 -6
- package/dist/utils/index.d.cts +5 -5
- package/dist/utils/index.d.mts +6 -6
- package/dist/utils/index.mjs +6 -6
- package/dist/utils/parse-error.cjs +1 -1
- package/dist/utils/parse-error.d.cts +1 -1
- package/dist/utils/parse-error.d.mts +1 -1
- package/dist/utils/parse-error.mjs +1 -1
- package/dist/utils/parse.cjs +1 -1
- package/dist/utils/parse.d.cts +1 -1
- package/dist/utils/parse.d.mts +1 -1
- package/dist/utils/parse.mjs +1 -1
- package/dist/utils/stringify.cjs +1 -1
- package/dist/utils/stringify.d.cts +1 -1
- package/dist/utils/stringify.d.mts +1 -1
- package/dist/utils/stringify.mjs +1 -1
- package/dist/utils/strip-comments.cjs +1 -1
- package/dist/utils/strip-comments.d.cts +1 -1
- package/dist/utils/strip-comments.d.mts +1 -1
- package/dist/utils/strip-comments.mjs +1 -1
- package/package.json +6 -2
- package/dist/parse-error-7K8s4vWf.d.cts.map +0 -1
- package/dist/parse-error-DpEv3vo_.d.mts.map +0 -1
- package/dist/schema-BO1HCrxv.d.cts.map +0 -1
- package/dist/schema-CmH1V_uI.d.mts.map +0 -1
- package/dist/schema-DGmzxHja.mjs.map +0 -1
- package/dist/stringify-Bc8OkhIr.d.cts.map +0 -1
- package/dist/stringify-CFT1K1LE.d.mts.map +0 -1
- /package/dist/{code-frames-BmUvlJ0w.cjs → code-frames-ChE4PPdh.cjs} +0 -0
- /package/dist/{index-B_e8BwCm.d.cts → index-CsuikFeJ.d.mts} +0 -0
- /package/dist/{index-CCt0lwyI.d.mts → index-Dh6J9gb5.d.cts} +0 -0
- /package/dist/{index-CDAfh8Ew.d.cts → index-VmEFGBxN.d.cts} +0 -0
- /package/dist/{index-DvuJXuAN.d.mts → index-e6k85DKM.d.mts} +0 -0
- /package/dist/{is-number-c5xguIbS.cjs → is-number-CV8PbAUX.cjs} +0 -0
- /package/dist/{is-string-C2RK4Gjs.cjs → is-string-yY-B30hL.cjs} +0 -0
- /package/dist/{is-undefined-CnI0qe-z.cjs → is-undefined-DyZkA263.cjs} +0 -0
- /package/dist/{pointer-B3W_Sme3.cjs → pointer-Cvmor4sN.cjs} +0 -0
- /package/dist/{pointer-Dn__XOdY.mjs → pointer-DScQSL_a.mjs} +0 -0
- /package/dist/{strip-comments-CmEG_smS.cjs → strip-comments-CPoO4Wj2.cjs} +0 -0
- /package/dist/{utils-jN2UkvqB.cjs → utils-DrK7G5cq.cjs} +0 -0
- /package/dist/{utils-mEkKIcgl.mjs → utils-mO6p60ai.mjs} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog for Stryke - JSON
|
|
4
4
|
|
|
5
|
+
## [0.12.0](https://github.com/storm-software/stryke/releases/tag/json%400.12.0) (03/03/2026)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- **json:** Added `isJsonSchema7BooleanType` type-check function ([9ad702e0](https://github.com/storm-software/stryke/commit/9ad702e0))
|
|
10
|
+
- **json:** Added additional fields to schema type checks ([4f49866a](https://github.com/storm-software/stryke/commit/4f49866a))
|
|
11
|
+
- **json:** Added the `canonicalJson` helper function ([8d21e027](https://github.com/storm-software/stryke/commit/8d21e027))
|
|
12
|
+
|
|
13
|
+
### Updated Dependencies
|
|
14
|
+
|
|
15
|
+
- Updated **type-checks** to **v0.5.29**
|
|
16
|
+
- Updated **types** to **v0.10.43**
|
|
17
|
+
|
|
18
|
+
## [0.11.0](https://github.com/storm-software/stryke/releases/tag/json%400.11.0) (03/02/2026)
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
- **json:** Added `isStandardJsonSchema` helper function ([7d5e8fac](https://github.com/storm-software/stryke/commit/7d5e8fac))
|
|
23
|
+
- **json:** Added various type-checks to ensure JSON schema typings ([f772306f](https://github.com/storm-software/stryke/commit/f772306f))
|
|
24
|
+
|
|
25
|
+
### Updated Dependencies
|
|
26
|
+
|
|
27
|
+
- Updated **type-checks** to **v0.5.28**
|
|
28
|
+
- Updated **types** to **v0.10.42**
|
|
29
|
+
|
|
5
30
|
## [0.10.0](https://github.com/storm-software/stryke/releases/tag/json%400.10.0) (03/02/2026)
|
|
6
31
|
|
|
7
32
|
### Miscellaneous
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/canonical.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Converts a JavaScript value to a canonical JSON string representation. This function is used for signing JSON objects in a consistent way, ensuring that the same input will always produce the same output string. The canonicalization process includes:
|
|
4
|
+
* - Sorting object keys in lexicographical order.
|
|
5
|
+
* - Removing whitespace and line breaks.
|
|
6
|
+
* - Representing primitive values (null, boolean, number, string) in their standard JSON format.
|
|
7
|
+
* - Recursively applying these rules to nested objects and arrays.
|
|
8
|
+
*
|
|
9
|
+
* This function is designed to produce a deterministic string representation of a JSON value, which is essential for cryptographic signing and verification processes where the exact byte representation of the data must be consistent across different environments and implementations.
|
|
10
|
+
*
|
|
11
|
+
* @param obj - The JavaScript value to convert to a canonical JSON string.
|
|
12
|
+
* @returns A canonical JSON string representation of the input value.
|
|
13
|
+
*/
|
|
14
|
+
declare function canonicalJson(obj: unknown): string;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { canonicalJson as t };
|
|
17
|
+
//# sourceMappingURL=canonical-3PQxSh5G.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical-3PQxSh5G.d.cts","names":[],"sources":["../src/canonical.ts"],"sourcesContent":[],"mappings":";;AA8BA;;;;;;;;;;;iBAAgB,aAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region src/canonical.ts
|
|
2
|
+
/**
|
|
3
|
+
* Converts a JavaScript value to a canonical JSON string representation. This function is used for signing JSON objects in a consistent way, ensuring that the same input will always produce the same output string. The canonicalization process includes:
|
|
4
|
+
* - Sorting object keys in lexicographical order.
|
|
5
|
+
* - Removing whitespace and line breaks.
|
|
6
|
+
* - Representing primitive values (null, boolean, number, string) in their standard JSON format.
|
|
7
|
+
* - Recursively applying these rules to nested objects and arrays.
|
|
8
|
+
*
|
|
9
|
+
* This function is designed to produce a deterministic string representation of a JSON value, which is essential for cryptographic signing and verification processes where the exact byte representation of the data must be consistent across different environments and implementations.
|
|
10
|
+
*
|
|
11
|
+
* @param obj - The JavaScript value to convert to a canonical JSON string.
|
|
12
|
+
* @returns A canonical JSON string representation of the input value.
|
|
13
|
+
*/
|
|
14
|
+
function canonicalJson(obj) {
|
|
15
|
+
if (obj === null || obj === void 0) return "null";
|
|
16
|
+
if (typeof obj === "boolean" || typeof obj === "number") return JSON.stringify(obj);
|
|
17
|
+
if (typeof obj === "string") return JSON.stringify(obj);
|
|
18
|
+
if (Array.isArray(obj)) return `[${obj.map((item) => canonicalJson(item)).join(",")}]`;
|
|
19
|
+
if (typeof obj === "object") return `{${Object.keys(obj).sort().map((key) => {
|
|
20
|
+
const value = canonicalJson(obj[key]);
|
|
21
|
+
return `${JSON.stringify(key)}:${value}`;
|
|
22
|
+
}).join(",")}}`;
|
|
23
|
+
return "null";
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
export { canonicalJson as t };
|
|
28
|
+
//# sourceMappingURL=canonical-CVbmCnGM.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical-CVbmCnGM.mjs","names":[],"sources":["../src/canonical.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 * Converts a JavaScript value to a canonical JSON string representation. This function is used for signing JSON objects in a consistent way, ensuring that the same input will always produce the same output string. The canonicalization process includes:\n * - Sorting object keys in lexicographical order.\n * - Removing whitespace and line breaks.\n * - Representing primitive values (null, boolean, number, string) in their standard JSON format.\n * - Recursively applying these rules to nested objects and arrays.\n *\n * This function is designed to produce a deterministic string representation of a JSON value, which is essential for cryptographic signing and verification processes where the exact byte representation of the data must be consistent across different environments and implementations.\n *\n * @param obj - The JavaScript value to convert to a canonical JSON string.\n * @returns A canonical JSON string representation of the input value.\n */\nexport function canonicalJson(obj: unknown): string {\n if (obj === null || obj === undefined) {\n return \"null\";\n }\n\n if (typeof obj === \"boolean\" || typeof obj === \"number\") {\n return JSON.stringify(obj);\n }\n\n if (typeof obj === \"string\") {\n return JSON.stringify(obj);\n }\n\n if (Array.isArray(obj)) {\n const items = obj.map(item => canonicalJson(item));\n\n return `[${items.join(\",\")}]`;\n }\n\n if (typeof obj === \"object\") {\n const keys = Object.keys(obj).sort();\n const pairs = keys.map(key => {\n const value = canonicalJson((obj as Record<string, unknown>)[key]);\n\n return `${JSON.stringify(key)}:${value}`;\n });\n\n return `{${pairs.join(\",\")}}`;\n }\n\n return \"null\";\n}\n"],"mappings":";;;;;;;;;;;;;AA8BA,SAAgB,cAAc,KAAsB;AAClD,KAAI,QAAQ,QAAQ,QAAQ,OAC1B,QAAO;AAGT,KAAI,OAAO,QAAQ,aAAa,OAAO,QAAQ,SAC7C,QAAO,KAAK,UAAU,IAAI;AAG5B,KAAI,OAAO,QAAQ,SACjB,QAAO,KAAK,UAAU,IAAI;AAG5B,KAAI,MAAM,QAAQ,IAAI,CAGpB,QAAO,IAFO,IAAI,KAAI,SAAQ,cAAc,KAAK,CAAC,CAEjC,KAAK,IAAI,CAAC;AAG7B,KAAI,OAAO,QAAQ,SAQjB,QAAO,IAPM,OAAO,KAAK,IAAI,CAAC,MAAM,CACjB,KAAI,QAAO;EAC5B,MAAM,QAAQ,cAAe,IAAgC,KAAK;AAElE,SAAO,GAAG,KAAK,UAAU,IAAI,CAAC,GAAG;GACjC,CAEe,KAAK,IAAI,CAAC;AAG7B,QAAO"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/canonical.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Converts a JavaScript value to a canonical JSON string representation. This function is used for signing JSON objects in a consistent way, ensuring that the same input will always produce the same output string. The canonicalization process includes:
|
|
4
|
+
* - Sorting object keys in lexicographical order.
|
|
5
|
+
* - Removing whitespace and line breaks.
|
|
6
|
+
* - Representing primitive values (null, boolean, number, string) in their standard JSON format.
|
|
7
|
+
* - Recursively applying these rules to nested objects and arrays.
|
|
8
|
+
*
|
|
9
|
+
* This function is designed to produce a deterministic string representation of a JSON value, which is essential for cryptographic signing and verification processes where the exact byte representation of the data must be consistent across different environments and implementations.
|
|
10
|
+
*
|
|
11
|
+
* @param obj - The JavaScript value to convert to a canonical JSON string.
|
|
12
|
+
* @returns A canonical JSON string representation of the input value.
|
|
13
|
+
*/
|
|
14
|
+
declare function canonicalJson(obj: unknown): string;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { canonicalJson as t };
|
|
17
|
+
//# sourceMappingURL=canonical-DZDrZ9dv.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical-DZDrZ9dv.d.mts","names":[],"sources":["../src/canonical.ts"],"sourcesContent":[],"mappings":";;AA8BA;;;;;;;;;;;iBAAgB,aAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/canonical.ts
|
|
3
|
+
/**
|
|
4
|
+
* Converts a JavaScript value to a canonical JSON string representation. This function is used for signing JSON objects in a consistent way, ensuring that the same input will always produce the same output string. The canonicalization process includes:
|
|
5
|
+
* - Sorting object keys in lexicographical order.
|
|
6
|
+
* - Removing whitespace and line breaks.
|
|
7
|
+
* - Representing primitive values (null, boolean, number, string) in their standard JSON format.
|
|
8
|
+
* - Recursively applying these rules to nested objects and arrays.
|
|
9
|
+
*
|
|
10
|
+
* This function is designed to produce a deterministic string representation of a JSON value, which is essential for cryptographic signing and verification processes where the exact byte representation of the data must be consistent across different environments and implementations.
|
|
11
|
+
*
|
|
12
|
+
* @param obj - The JavaScript value to convert to a canonical JSON string.
|
|
13
|
+
* @returns A canonical JSON string representation of the input value.
|
|
14
|
+
*/
|
|
15
|
+
function canonicalJson(obj) {
|
|
16
|
+
if (obj === null || obj === void 0) return "null";
|
|
17
|
+
if (typeof obj === "boolean" || typeof obj === "number") return JSON.stringify(obj);
|
|
18
|
+
if (typeof obj === "string") return JSON.stringify(obj);
|
|
19
|
+
if (Array.isArray(obj)) return `[${obj.map((item) => canonicalJson(item)).join(",")}]`;
|
|
20
|
+
if (typeof obj === "object") return `{${Object.keys(obj).sort().map((key) => {
|
|
21
|
+
const value = canonicalJson(obj[key]);
|
|
22
|
+
return `${JSON.stringify(key)}:${value}`;
|
|
23
|
+
}).join(",")}}`;
|
|
24
|
+
return "null";
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
Object.defineProperty(exports, 'canonicalJson', {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () {
|
|
31
|
+
return canonicalJson;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-frames-
|
|
1
|
+
{"version":3,"file":"code-frames-BOS_tt9F.d.mts","names":[],"sources":["../src/utils/code-frames.ts"],"sourcesContent":[],"mappings":";UAkBU,QAAA;EAAA,MAAA,EAAA,MAAQ;EAKR,IAAA,EAAA,MAAA;AAoFV;UApFU,YAAA;QACF;UACE;;iBAkFM,gBAAA,wBAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-frames-
|
|
1
|
+
{"version":3,"file":"code-frames-C8DEdLmV.mjs","names":["startLoc: Location","endLoc: Location"],"sources":["../src/utils/code-frames.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\ninterface Location {\n column: number;\n line: number;\n}\n\ninterface NodeLocation {\n end?: Location;\n start?: Location;\n}\n\n// Adapted from https://raw.githubusercontent.com/babel/babel/4108524/packages/babel-code-frame/src/index.js\n\n/**\n * RegExp to test for newlines in terminal.\n */\nconst NEWLINE = /\\r\\n|[\\n\\r\\u2028\\u2029]/;\n\n/**\n * Extract what lines should be marked and highlighted.\n */\nfunction getMarkerLines(\n loc: NodeLocation,\n source: string[],\n opts: { linesAbove?: number; linesBelow?: number } = {}\n): {\n start: number;\n end: number;\n markerLines: Record<number, boolean | [number, number]>;\n} {\n const startLoc: Location = {\n column: 0,\n line: -1,\n ...loc.start\n };\n const endLoc: Location = {\n ...startLoc,\n ...loc.end\n };\n const { linesAbove = 2, linesBelow = 3 } = opts || {};\n const startLine = startLoc.line;\n const startColumn = startLoc.column;\n const endLine = endLoc.line;\n const endColumn = endLoc.column;\n\n let start = Math.max(startLine - (linesAbove + 1), 0);\n let end = Math.min(source.length, endLine + linesBelow);\n\n if (startLine === -1) {\n start = 0;\n }\n\n if (endLine === -1) {\n end = source.length;\n }\n\n const lineDiff = endLine - startLine;\n const markerLines = {} as Record<number, boolean | [number, number]>;\n\n if (lineDiff) {\n for (let i = 0; i <= lineDiff; i++) {\n const lineNumber = i + startLine;\n\n if (!startColumn) {\n markerLines[lineNumber] = true;\n } else if (i === 0) {\n const sourceLength = source[lineNumber - 1]?.length ?? 0;\n\n markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];\n } else if (i === lineDiff) {\n markerLines[lineNumber] = [0, endColumn];\n } else {\n const sourceLength = source[lineNumber - i]?.length ?? 0;\n\n markerLines[lineNumber] = [0, sourceLength];\n }\n }\n } else if (startColumn === endColumn) {\n markerLines[startLine] = startColumn ? [startColumn, 0] : true;\n } else {\n markerLines[startLine] = [startColumn, endColumn - startColumn];\n }\n\n return {\n start,\n end,\n markerLines\n };\n}\n\nexport function codeFrameColumns(\n rawLines: string,\n loc: NodeLocation,\n opts: {\n linesAbove?: number;\n linesBelow?: number;\n highlight?: (rawLines: string) => string;\n } = {}\n): string {\n const lines = rawLines.split(NEWLINE);\n const { start, end, markerLines } = getMarkerLines(loc, lines, opts);\n\n const numberMaxWidth = String(end).length;\n const highlightedLines = opts.highlight ? opts.highlight(rawLines) : rawLines;\n\n const frame = highlightedLines\n .split(NEWLINE)\n .slice(start, end)\n .map((line, index) => {\n const number = start + 1 + index;\n const paddedNumber = ` ${number}`.slice(-numberMaxWidth);\n const gutter = ` ${paddedNumber} | `;\n const hasMarker = Boolean(markerLines[number] ?? false);\n if (hasMarker) {\n let markerLine = \"\";\n if (Array.isArray(hasMarker)) {\n const markerSpacing = line\n .slice(0, Math.max(hasMarker[0] - 1, 0))\n .replace(/[^\\t]/g, \" \");\n const numberOfMarkers = hasMarker[1] || 1;\n\n markerLine = [\n \"\\n \",\n gutter.replace(/\\d/g, \" \"),\n markerSpacing,\n \"^\".repeat(numberOfMarkers)\n ].join(\"\");\n }\n return [\">\", gutter, line, markerLine].join(\"\");\n }\n return ` ${gutter}${line}`;\n })\n .join(\"\\n\");\n\n return frame;\n}\n"],"mappings":";;;;AAiCA,MAAM,UAAU;;;;AAKhB,SAAS,eACP,KACA,QACA,OAAqD,EAAE,EAKvD;CACA,MAAMA,WAAqB;EACzB,QAAQ;EACR,MAAM;EACN,GAAG,IAAI;EACR;CACD,MAAMC,SAAmB;EACvB,GAAG;EACH,GAAG,IAAI;EACR;CACD,MAAM,EAAE,aAAa,GAAG,aAAa,MAAM,QAAQ,EAAE;CACrD,MAAM,YAAY,SAAS;CAC3B,MAAM,cAAc,SAAS;CAC7B,MAAM,UAAU,OAAO;CACvB,MAAM,YAAY,OAAO;CAEzB,IAAI,QAAQ,KAAK,IAAI,aAAa,aAAa,IAAI,EAAE;CACrD,IAAI,MAAM,KAAK,IAAI,OAAO,QAAQ,UAAU,WAAW;AAEvD,KAAI,cAAc,GAChB,SAAQ;AAGV,KAAI,YAAY,GACd,OAAM,OAAO;CAGf,MAAM,WAAW,UAAU;CAC3B,MAAM,cAAc,EAAE;AAEtB,KAAI,SACF,MAAK,IAAI,IAAI,GAAG,KAAK,UAAU,KAAK;EAClC,MAAM,aAAa,IAAI;AAEvB,MAAI,CAAC,YACH,aAAY,cAAc;WACjB,MAAM,EAGf,aAAY,cAAc,CAAC,cAFN,OAAO,aAAa,IAAI,UAAU,KAEA,cAAc,EAAE;WAC9D,MAAM,SACf,aAAY,cAAc,CAAC,GAAG,UAAU;MAIxC,aAAY,cAAc,CAAC,GAFN,OAAO,aAAa,IAAI,UAAU,EAEZ;;UAGtC,gBAAgB,UACzB,aAAY,aAAa,cAAc,CAAC,aAAa,EAAE,GAAG;KAE1D,aAAY,aAAa,CAAC,aAAa,YAAY,YAAY;AAGjE,QAAO;EACL;EACA;EACA;EACD;;AAGH,SAAgB,iBACd,UACA,KACA,OAII,EAAE,EACE;CAER,MAAM,EAAE,OAAO,KAAK,gBAAgB,eAAe,KADrC,SAAS,MAAM,QAAQ,EAC0B,KAAK;CAEpE,MAAM,iBAAiB,OAAO,IAAI,CAAC;AAgCnC,SA/ByB,KAAK,YAAY,KAAK,UAAU,SAAS,GAAG,UAGlE,MAAM,QAAQ,CACd,MAAM,OAAO,IAAI,CACjB,KAAK,MAAM,UAAU;EACpB,MAAM,SAAS,QAAQ,IAAI;EAE3B,MAAM,SAAS,IADM,IAAI,SAAS,MAAM,CAAC,eAAe,CACxB;EAChC,MAAM,YAAY,QAAQ,YAAY,WAAW,MAAM;AACvD,MAAI,WAAW;GACb,IAAI,aAAa;AACjB,OAAI,MAAM,QAAQ,UAAU,EAAE;IAC5B,MAAM,gBAAgB,KACnB,MAAM,GAAG,KAAK,IAAI,UAAU,KAAK,GAAG,EAAE,CAAC,CACvC,QAAQ,UAAU,IAAI;IACzB,MAAM,kBAAkB,UAAU,MAAM;AAExC,iBAAa;KACX;KACA,OAAO,QAAQ,OAAO,IAAI;KAC1B;KACA,IAAI,OAAO,gBAAgB;KAC5B,CAAC,KAAK,GAAG;;AAEZ,UAAO;IAAC;IAAK;IAAQ;IAAM;IAAW,CAAC,KAAK,GAAG;;AAEjD,SAAO,IAAI,SAAS;GACpB,CACD,KAAK,KAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-frames-
|
|
1
|
+
{"version":3,"file":"code-frames-ClyQ9O1l.d.cts","names":[],"sources":["../src/utils/code-frames.ts"],"sourcesContent":[],"mappings":";UAkBU,QAAA;EAAA,MAAA,EAAA,MAAQ;EAKR,IAAA,EAAA,MAAA;AAoFV;UApFU,YAAA;QACF;UACE;;iBAkFM,gBAAA,wBAET"}
|
|
@@ -49,4 +49,4 @@ interface ObjectReference<T = unknown> {
|
|
|
49
49
|
declare const isObjectReference: <T = unknown>(ref: Reference) => ref is ObjectReference<T>;
|
|
50
50
|
//#endregion
|
|
51
51
|
export { isArrayEnd as a, find as i, ObjectReference as n, isArrayReference as o, Reference as r, isObjectReference as s, ArrayReference as t };
|
|
52
|
-
//# sourceMappingURL=find-reference-
|
|
52
|
+
//# sourceMappingURL=find-reference-BuuNqqOh.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-reference-
|
|
1
|
+
{"version":3,"file":"find-reference-BuuNqqOh.d.cts","names":[],"sources":["../src/pointer/find-reference.ts"],"sourcesContent":[],"mappings":";UAqBiB,SAAA;EAAA;EAoCJ,SAyCZ,GAAA,EAAA,OAzCwC;EA2CxB;EAOJ,SAAA,GAAA,CAAA,EAAA,OAEiE,GAAA,MAAA,GAAA,OAAA,EAAA;EADvE;EACkB,SAAA,GAAA,CAAA,EAAA,MAAA,GAAA,MAAA;;;AAEzB;AAGA;;;;;AAMA;;;;;;;;;;;;;;;;;;cA/Da,2BAA4B,uBAAqB;UA2C7C;;4BAEW;gBACZ;;;cAIH,qCACN,qBACG,eAAe;cAEZ,kBAAmB;UAGf;gBACD;gBACA,eAAe;;;cAIlB,sCACN,qBACG,gBAAgB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_is_set_object = require('./is-set-object-
|
|
2
|
-
const require_is_string = require('./is-string-
|
|
1
|
+
const require_is_set_object = require('./is-set-object-5lZPw_Pq.cjs');
|
|
2
|
+
const require_is_string = require('./is-string-yY-B30hL.cjs');
|
|
3
3
|
|
|
4
4
|
//#region src/pointer/find-reference.ts
|
|
5
5
|
const { isArray } = Array;
|
|
@@ -49,4 +49,4 @@ interface ObjectReference<T = unknown> {
|
|
|
49
49
|
declare const isObjectReference: <T = unknown>(ref: Reference) => ref is ObjectReference<T>;
|
|
50
50
|
//#endregion
|
|
51
51
|
export { isArrayEnd as a, find as i, ObjectReference as n, isArrayReference as o, Reference as r, isObjectReference as s, ArrayReference as t };
|
|
52
|
-
//# sourceMappingURL=find-reference-
|
|
52
|
+
//# sourceMappingURL=find-reference-MHRH7HJ_.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-reference-
|
|
1
|
+
{"version":3,"file":"find-reference-MHRH7HJ_.d.mts","names":[],"sources":["../src/pointer/find-reference.ts"],"sourcesContent":[],"mappings":";UAqBiB,SAAA;EAAA;EAoCJ,SAyCZ,GAAA,EAAA,OAzCwC;EA2CxB;EAOJ,SAAA,GAAA,CAAA,EAAA,OAEiE,GAAA,MAAA,GAAA,OAAA,EAAA;EADvE;EACkB,SAAA,GAAA,CAAA,EAAA,MAAA,GAAA,MAAA;;;AAEzB;AAGA;;;;;AAMA;;;;;;;;;;;;;;;;;;cA/Da,2BAA4B,uBAAqB;UA2C7C;;4BAEW;gBACZ;;;cAIH,qCACN,qBACG,eAAe;cAEZ,kBAAmB;UAGf;gBACD;gBACA,eAAe;;;cAIlB,sCACN,qBACG,gBAAgB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as isSetObject } from "./is-set-object-
|
|
2
|
-
import { t as isString } from "./is-string
|
|
1
|
+
import { t as isSetObject } from "./is-set-object-yxjp5vg-.mjs";
|
|
2
|
+
import { t as isString } from "./is-string--ny35huw.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/pointer/find-reference.ts
|
|
5
5
|
const { isArray } = Array;
|
|
@@ -61,4 +61,4 @@ const isObjectReference = (ref) => typeof ref.obj === "object" && typeof ref.key
|
|
|
61
61
|
|
|
62
62
|
//#endregion
|
|
63
63
|
export { isObjectReference as i, isArrayEnd as n, isArrayReference as r, find as t };
|
|
64
|
-
//# sourceMappingURL=find-reference-
|
|
64
|
+
//# sourceMappingURL=find-reference-kPgdulJ1.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-reference-
|
|
1
|
+
{"version":3,"file":"find-reference-kPgdulJ1.mjs","names":["obj: Reference[\"obj\"]","key: Reference[\"key\"]"],"sources":["../src/pointer/find-reference.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 { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isString } from \"@stryke/type-checks/is-string\";\n\nexport interface Reference {\n /** Target value where pointer is pointing. */\n readonly val: unknown;\n /** Object which contains the target value. */\n readonly obj?: unknown | object | unknown[];\n /** Key which targets the target value in the object. */\n readonly key?: string | number;\n}\n\nconst { isArray } = Array;\n\n/**\n * Finds a target in document specified by JSON Pointer. Also returns the\n * object containing the target and key used to reference that object.\n *\n * Throws Error('NOT_FOUND') if pointer does not result into a value in the middle\n * of the path. If the last element of the path does not result into a value, the\n * lookup succeeds with `val` set to `undefined`. It can be used to discriminate\n * missing values, because `undefined` is not a valid JSON value.\n *\n * If last element in array is targeted using \"-\", e.g. \"/arr/-\", use\n * `isArrayEnd` to verify that:\n *\n * ```js\n * const ref = find({arr: [1, 2, 3], ['arr', '-']});\n * if (isArrayReference(ref)) {\n * if (isArrayEnd(ref)) {\n * // ...\n * }\n * }\n * ```\n *\n * @param val - Document to search in.\n * @param path - JSON Pointer path.\n * @returns Reference to the target.\n */\nexport const find = (val: unknown, path: Reference[\"key\"][]): Reference => {\n const pathLength = path.length;\n if (!pathLength) {\n return { val };\n }\n\n let obj: Reference[\"obj\"];\n let key: Reference[\"key\"];\n for (let i = 0; i < pathLength; i++) {\n obj = val;\n key = path[i];\n if (isArray(obj)) {\n const length = obj.length;\n if (key === \"-\") {\n key = length;\n } else if (isString(key)) {\n const key2 = Math.trunc(Number.parseInt(key));\n if (String(key2) !== key) {\n throw new Error(\"INVALID_INDEX\");\n }\n\n key = key2;\n if (key < 0) {\n throw new Error(\"INVALID_INDEX\");\n }\n }\n\n if (key) {\n val = obj[key];\n }\n } else if (isSetObject(obj)) {\n val = key && key in obj ? (obj as any)[key] : undefined;\n } else throw new Error(\"NOT_FOUND\");\n }\n const ref: Reference = {\n val,\n obj,\n key\n };\n\n return ref;\n};\n\nexport interface ArrayReference<T = unknown> {\n /** `undefined` in case JSON Pointer points to last element, e.g. \"/foo/-\". */\n readonly val: undefined | T;\n readonly obj: T[];\n readonly key: number;\n}\n\nexport const isArrayReference = <T = unknown>(\n ref: Reference\n): ref is ArrayReference<T> => isArray(ref.obj) && typeof ref.key === \"number\";\n\nexport const isArrayEnd = (ref: ArrayReference): boolean =>\n ref.obj.length === ref.key;\n\nexport interface ObjectReference<T = unknown> {\n readonly val: T;\n readonly obj: Record<string, T>;\n readonly key: string;\n}\n\nexport const isObjectReference = <T = unknown>(\n ref: Reference\n): ref is ObjectReference<T> =>\n typeof ref.obj === \"object\" && typeof ref.key === \"string\";\n"],"mappings":";;;;AA8BA,MAAM,EAAE,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BpB,MAAa,QAAQ,KAAc,SAAwC;CACzE,MAAM,aAAa,KAAK;AACxB,KAAI,CAAC,WACH,QAAO,EAAE,KAAK;CAGhB,IAAIA;CACJ,IAAIC;AACJ,MAAK,IAAI,IAAI,GAAG,IAAI,YAAY,KAAK;AACnC,QAAM;AACN,QAAM,KAAK;AACX,MAAI,QAAQ,IAAI,EAAE;GAChB,MAAM,SAAS,IAAI;AACnB,OAAI,QAAQ,IACV,OAAM;YACG,SAAS,IAAI,EAAE;IACxB,MAAM,OAAO,KAAK,MAAM,OAAO,SAAS,IAAI,CAAC;AAC7C,QAAI,OAAO,KAAK,KAAK,IACnB,OAAM,IAAI,MAAM,gBAAgB;AAGlC,UAAM;AACN,QAAI,MAAM,EACR,OAAM,IAAI,MAAM,gBAAgB;;AAIpC,OAAI,IACF,OAAM,IAAI;aAEH,YAAY,IAAI,CACzB,OAAM,OAAO,OAAO,MAAO,IAAY,OAAO;MACzC,OAAM,IAAI,MAAM,YAAY;;AAQrC,QANuB;EACrB;EACA;EACA;EACD;;AAYH,MAAa,oBACX,QAC6B,QAAQ,IAAI,IAAI,IAAI,OAAO,IAAI,QAAQ;AAEtE,MAAa,cAAc,QACzB,IAAI,IAAI,WAAW,IAAI;AAQzB,MAAa,qBACX,QAEA,OAAO,IAAI,QAAQ,YAAY,OAAO,IAAI,QAAQ"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
const require_storm_json = require('./storm-json-
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
require('./
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
1
|
+
const require_storm_json = require('./storm-json-BDPXNC_u.cjs');
|
|
2
|
+
const require_canonical = require('./canonical-hMXtzPIV.cjs');
|
|
3
|
+
const require_find_reference = require('./find-reference-Ct8UDBo2.cjs');
|
|
4
|
+
const require_parse = require('./parse-BSmqrTy_.cjs');
|
|
5
|
+
require('./pointer-Cvmor4sN.cjs');
|
|
6
|
+
const require_schema = require('./schema-CwyRhvHe.cjs');
|
|
7
|
+
const require_strip_comments = require('./strip-comments-CPoO4Wj2.cjs');
|
|
8
|
+
const require_parse$1 = require('./parse-CX9jPskm.cjs');
|
|
9
|
+
const require_code_frames = require('./code-frames-ChE4PPdh.cjs');
|
|
10
|
+
const require_parse_error = require('./parse-error-CUOf-YBA.cjs');
|
|
11
|
+
const require_stringify = require('./stringify-DQOBApRO.cjs');
|
|
11
12
|
require('./types.cjs');
|
|
12
|
-
require('./utils-
|
|
13
|
+
require('./utils-DrK7G5cq.cjs');
|
|
13
14
|
|
|
14
15
|
exports.StormJSON = require_storm_json.StormJSON;
|
|
16
|
+
exports.canonicalJson = require_canonical.canonicalJson;
|
|
15
17
|
exports.codeFrameColumns = require_code_frames.codeFrameColumns;
|
|
16
18
|
exports.escapePointerSegment = require_parse.escapePointerSegment;
|
|
17
19
|
exports.find = require_find_reference.find;
|
|
@@ -23,9 +25,13 @@ exports.isArrayReference = require_find_reference.isArrayReference;
|
|
|
23
25
|
exports.isInteger = require_parse.isInteger;
|
|
24
26
|
exports.isJsonSchema7AllOfType = require_schema.isJsonSchema7AllOfType;
|
|
25
27
|
exports.isJsonSchema7ArrayType = require_schema.isJsonSchema7ArrayType;
|
|
28
|
+
exports.isJsonSchema7BooleanType = require_schema.isJsonSchema7BooleanType;
|
|
26
29
|
exports.isJsonSchema7LiteralType = require_schema.isJsonSchema7LiteralType;
|
|
30
|
+
exports.isJsonSchema7NumberType = require_schema.isJsonSchema7NumberType;
|
|
27
31
|
exports.isJsonSchema7ObjectType = require_schema.isJsonSchema7ObjectType;
|
|
28
32
|
exports.isJsonSchema7PrimitiveLiteralType = require_schema.isJsonSchema7PrimitiveLiteralType;
|
|
33
|
+
exports.isJsonSchema7StringType = require_schema.isJsonSchema7StringType;
|
|
34
|
+
exports.isJsonSchema7TupleType = require_schema.isJsonSchema7TupleType;
|
|
29
35
|
exports.isObjectReference = require_find_reference.isObjectReference;
|
|
30
36
|
exports.isRoot = require_parse.isRoot;
|
|
31
37
|
exports.isStandardJsonSchema = require_schema.isStandardJsonSchema;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
3
|
-
import {
|
|
4
|
-
import { a as
|
|
5
|
-
import { t as
|
|
6
|
-
import { t as
|
|
7
|
-
import {
|
|
8
|
-
import { t as
|
|
9
|
-
import {
|
|
10
|
-
import { t as
|
|
11
|
-
|
|
1
|
+
import { t as canonicalJson } from "./canonical-3PQxSh5G.cjs";
|
|
2
|
+
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-BuuNqqOh.cjs";
|
|
3
|
+
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-DCHSu_0u.cjs";
|
|
4
|
+
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-BzNIRhpI.cjs";
|
|
5
|
+
import { a as isJsonSchema7NumberType, c as isJsonSchema7StringType, i as isJsonSchema7LiteralType, l as isJsonSchema7TupleType, n as isJsonSchema7ArrayType, o as isJsonSchema7ObjectType, r as isJsonSchema7BooleanType, s as isJsonSchema7PrimitiveLiteralType, t as isJsonSchema7AllOfType, u as isStandardJsonSchema } from "./schema-CuBX00tF.cjs";
|
|
6
|
+
import { t as StormJSON } from "./storm-json-DiBg5b6r.cjs";
|
|
7
|
+
import { t as codeFrameColumns } from "./code-frames-ClyQ9O1l.cjs";
|
|
8
|
+
import { n as parse, r as safeParse, t as Options } from "./parse-ygKFNauQ.cjs";
|
|
9
|
+
import { t as formatParseError } from "./parse-error-CGKcBkMJ.cjs";
|
|
10
|
+
import { n as stringify, t as invalidKeyChars } from "./stringify-mAxwby9q.cjs";
|
|
11
|
+
import { t as stripComments } from "./strip-comments-AOXnoydB.cjs";
|
|
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, canonicalJson, codeFrameColumns, escapePointerSegment, find, formatJsonPointer, formatParseError, invalidKeyChars, isArrayEnd, isArrayReference, isInteger, isJsonSchema7AllOfType, isJsonSchema7ArrayType, isJsonSchema7BooleanType, isJsonSchema7LiteralType, isJsonSchema7NumberType, isJsonSchema7ObjectType, isJsonSchema7PrimitiveLiteralType, isJsonSchema7StringType, isJsonSchema7TupleType, isObjectReference, isRoot, isStandardJsonSchema, isValidIndex, parent, parse, parseJsonPointer, safeParse, stringify, stripComments, unescapePointerSegment };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
3
|
-
import {
|
|
4
|
-
import { a as
|
|
5
|
-
import { t as
|
|
6
|
-
import { t as
|
|
7
|
-
import {
|
|
8
|
-
import { t as
|
|
9
|
-
import {
|
|
10
|
-
import { t as
|
|
11
|
-
import "./
|
|
12
|
-
|
|
1
|
+
import { t as canonicalJson } from "./canonical-DZDrZ9dv.mjs";
|
|
2
|
+
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-MHRH7HJ_.mjs";
|
|
3
|
+
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-DaiwKCLz.mjs";
|
|
4
|
+
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-BAtAPir9.mjs";
|
|
5
|
+
import { a as isJsonSchema7NumberType, c as isJsonSchema7StringType, i as isJsonSchema7LiteralType, l as isJsonSchema7TupleType, n as isJsonSchema7ArrayType, o as isJsonSchema7ObjectType, r as isJsonSchema7BooleanType, s as isJsonSchema7PrimitiveLiteralType, t as isJsonSchema7AllOfType, u as isStandardJsonSchema } from "./schema-D5wPTiM4.mjs";
|
|
6
|
+
import { t as StormJSON } from "./storm-json-DJwb3Ou-.mjs";
|
|
7
|
+
import { t as codeFrameColumns } from "./code-frames-BOS_tt9F.mjs";
|
|
8
|
+
import { n as parse, r as safeParse, t as Options } from "./parse-XXQfTfNE.mjs";
|
|
9
|
+
import { t as formatParseError } from "./parse-error-CDt01Gvc.mjs";
|
|
10
|
+
import { n as stringify, t as invalidKeyChars } from "./stringify-DtMcg2Wy.mjs";
|
|
11
|
+
import { t as stripComments } from "./strip-comments-BNN6Uf4e.mjs";
|
|
12
|
+
import "./index-e6k85DKM.mjs";
|
|
13
|
+
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, canonicalJson, codeFrameColumns, escapePointerSegment, find, formatJsonPointer, formatParseError, invalidKeyChars, isArrayEnd, isArrayReference, isInteger, isJsonSchema7AllOfType, isJsonSchema7ArrayType, isJsonSchema7BooleanType, isJsonSchema7LiteralType, isJsonSchema7NumberType, isJsonSchema7ObjectType, isJsonSchema7PrimitiveLiteralType, isJsonSchema7StringType, isJsonSchema7TupleType, isObjectReference, isRoot, isStandardJsonSchema, isValidIndex, parent, parse, parseJsonPointer, safeParse, stringify, stripComments, unescapePointerSegment };
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "./
|
|
4
|
-
import
|
|
5
|
-
import { t as
|
|
6
|
-
import {
|
|
7
|
-
import { t as
|
|
8
|
-
import { t as
|
|
9
|
-
import {
|
|
10
|
-
import { t as
|
|
1
|
+
import { t as canonicalJson } from "./canonical-CVbmCnGM.mjs";
|
|
2
|
+
import { i as isObjectReference, n as isArrayEnd, r as isArrayReference, t as find } from "./find-reference-kPgdulJ1.mjs";
|
|
3
|
+
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-B3NfTO06.mjs";
|
|
4
|
+
import "./pointer-DScQSL_a.mjs";
|
|
5
|
+
import { a as isJsonSchema7NumberType, c as isJsonSchema7StringType, i as isJsonSchema7LiteralType, l as isJsonSchema7TupleType, n as isJsonSchema7ArrayType, o as isJsonSchema7ObjectType, r as isJsonSchema7BooleanType, s as isJsonSchema7PrimitiveLiteralType, t as isJsonSchema7AllOfType, u as isStandardJsonSchema } from "./schema-CMt54x11.mjs";
|
|
6
|
+
import { t as stripComments } from "./strip-comments-DNTu6CWM.mjs";
|
|
7
|
+
import { n as safeParse, t as parse } from "./parse-BrChHTWb.mjs";
|
|
8
|
+
import { t as codeFrameColumns } from "./code-frames-C8DEdLmV.mjs";
|
|
9
|
+
import { t as formatParseError } from "./parse-error-Cu6mjBS7.mjs";
|
|
10
|
+
import { n as stringify, t as invalidKeyChars } from "./stringify-CfeAVjh8.mjs";
|
|
11
|
+
import { t as StormJSON } from "./storm-json-BmO91crX.mjs";
|
|
11
12
|
import "./types.mjs";
|
|
12
|
-
import "./utils-
|
|
13
|
+
import "./utils-mO6p60ai.mjs";
|
|
13
14
|
|
|
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 };
|
|
15
|
+
export { StormJSON, canonicalJson, codeFrameColumns, escapePointerSegment, find, formatJsonPointer, formatParseError, invalidKeyChars, isArrayEnd, isArrayReference, isInteger, isJsonSchema7AllOfType, isJsonSchema7ArrayType, isJsonSchema7BooleanType, isJsonSchema7LiteralType, isJsonSchema7NumberType, isJsonSchema7ObjectType, isJsonSchema7PrimitiveLiteralType, isJsonSchema7StringType, isJsonSchema7TupleType, isObjectReference, isRoot, isStandardJsonSchema, isValidIndex, parent, parse, parseJsonPointer, safeParse, stringify, stripComments, unescapePointerSegment };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-number-
|
|
1
|
+
{"version":3,"file":"is-number-BMxmACAS.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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as getObjectTag } from "./is-number-
|
|
1
|
+
import { n as getObjectTag } from "./is-number-BMxmACAS.mjs";
|
|
2
2
|
|
|
3
3
|
//#region ../type-checks/src/is-plain-object.ts
|
|
4
4
|
/**
|
|
@@ -77,4 +77,4 @@ const isObject = (value) => {
|
|
|
77
77
|
|
|
78
78
|
//#endregion
|
|
79
79
|
export { isObject as t };
|
|
80
|
-
//# sourceMappingURL=is-object-
|
|
80
|
+
//# sourceMappingURL=is-object-BYxzKTYU.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-object-
|
|
1
|
+
{"version":3,"file":"is-object-BYxzKTYU.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,6 +1,6 @@
|
|
|
1
|
-
const require_is_number = require('./is-number-
|
|
2
|
-
const require_is_object = require('./is-object-
|
|
3
|
-
const require_is_undefined = require('./is-undefined-
|
|
1
|
+
const require_is_number = require('./is-number-CV8PbAUX.cjs');
|
|
2
|
+
const require_is_object = require('./is-object-BbRMEXAo.cjs');
|
|
3
|
+
const require_is_undefined = require('./is-undefined-DyZkA263.cjs');
|
|
4
4
|
|
|
5
5
|
//#region ../type-checks/src/is-function.ts
|
|
6
6
|
function isSyncFunction(value) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as getObjectTag } from "./is-number-
|
|
2
|
-
import { t as isObject } from "./is-object-
|
|
3
|
-
import { t as isUndefined } from "./is-undefined-
|
|
1
|
+
import { n as getObjectTag } from "./is-number-BMxmACAS.mjs";
|
|
2
|
+
import { t as isObject } from "./is-object-BYxzKTYU.mjs";
|
|
3
|
+
import { t as isUndefined } from "./is-undefined-CqNzBssC.mjs";
|
|
4
4
|
|
|
5
5
|
//#region ../type-checks/src/is-function.ts
|
|
6
6
|
function isSyncFunction(value) {
|
|
@@ -95,4 +95,4 @@ const isSetObject = (value) => {
|
|
|
95
95
|
|
|
96
96
|
//#endregion
|
|
97
97
|
export { isFunction as n, isSetObject as t };
|
|
98
|
-
//# sourceMappingURL=is-set-object-
|
|
98
|
+
//# sourceMappingURL=is-set-object-yxjp5vg-.mjs.map
|