@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.
Files changed (204) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/code-frames-BUtrssZ5.d.cts +17 -0
  3. package/dist/code-frames-BUtrssZ5.d.cts.map +1 -0
  4. package/dist/code-frames-BmUvlJ0w.cjs +82 -0
  5. package/dist/code-frames-CrTAYYSE.d.mts +17 -0
  6. package/dist/code-frames-CrTAYYSE.d.mts.map +1 -0
  7. package/dist/code-frames-DuBfTMu4.mjs +77 -0
  8. package/dist/code-frames-DuBfTMu4.mjs.map +1 -0
  9. package/dist/find-reference-B8xshNXL.d.mts +52 -0
  10. package/dist/find-reference-B8xshNXL.d.mts.map +1 -0
  11. package/dist/find-reference-C-YleCds.d.cts +52 -0
  12. package/dist/find-reference-C-YleCds.d.cts.map +1 -0
  13. package/dist/find-reference-DMSYEaaI.mjs +64 -0
  14. package/dist/find-reference-DMSYEaaI.mjs.map +1 -0
  15. package/dist/find-reference-De5vBQV2.cjs +86 -0
  16. package/dist/index-B_e8BwCm.d.cts +1 -0
  17. package/dist/index-CCt0lwyI.d.mts +1 -0
  18. package/dist/index-CDAfh8Ew.d.cts +1 -0
  19. package/dist/index-DvuJXuAN.d.mts +1 -0
  20. package/dist/index.cjs +37 -14
  21. package/dist/index.d.cts +11 -8
  22. package/dist/index.d.mts +12 -9
  23. package/dist/index.mjs +13 -8
  24. package/dist/is-number-BIwzZzyi.mjs +31 -0
  25. package/dist/is-number-BIwzZzyi.mjs.map +1 -0
  26. package/dist/is-number-c5xguIbS.cjs +42 -0
  27. package/dist/{type-checks/src/is-plain-object.mjs → is-object-BpfmzHWa.mjs} +19 -3
  28. package/dist/is-object-BpfmzHWa.mjs.map +1 -0
  29. package/dist/{type-checks/src/is-plain-object.cjs → is-object-umGh91v1.cjs} +24 -3
  30. package/dist/is-set-object-BmHip9em.cjs +108 -0
  31. package/dist/is-set-object-C1Qnj1Q8.mjs +98 -0
  32. package/dist/is-set-object-C1Qnj1Q8.mjs.map +1 -0
  33. package/dist/{type-checks/src/is-string.mjs → is-string-C2RK4Gjs.cjs} +7 -2
  34. package/dist/{type-checks/src/is-string.cjs → is-string-CLiBUSKV.mjs} +2 -2
  35. package/dist/is-string-CLiBUSKV.mjs.map +1 -0
  36. package/dist/{type-checks/src/is-undefined.cjs → is-undefined-CmyJWYGD.mjs} +2 -2
  37. package/dist/is-undefined-CmyJWYGD.mjs.map +1 -0
  38. package/dist/{type-checks/src/is-undefined.mjs → is-undefined-CnI0qe-z.cjs} +7 -2
  39. package/dist/parse-BGlhbY16.d.cts +9 -0
  40. package/dist/parse-BGlhbY16.d.cts.map +1 -0
  41. package/dist/parse-Bp6kkcQ4.cjs +127 -0
  42. package/dist/parse-ByDxRup5.cjs +62 -0
  43. package/dist/parse-Cj-YfhrI.d.mts +51 -0
  44. package/dist/parse-Cj-YfhrI.d.mts.map +1 -0
  45. package/dist/parse-DZfi3d96.d.cts +51 -0
  46. package/dist/parse-DZfi3d96.d.cts.map +1 -0
  47. package/dist/parse-Dn43ZK9y.mjs +52 -0
  48. package/dist/parse-Dn43ZK9y.mjs.map +1 -0
  49. package/dist/parse-error-7K8s4vWf.d.cts +15 -0
  50. package/dist/parse-error-7K8s4vWf.d.cts.map +1 -0
  51. package/dist/parse-error-Af4zHUQ_.mjs +34 -0
  52. package/dist/parse-error-Af4zHUQ_.mjs.map +1 -0
  53. package/dist/parse-error-DpEv3vo_.d.mts +15 -0
  54. package/dist/parse-error-DpEv3vo_.d.mts.map +1 -0
  55. package/dist/parse-error-N7UE-HMh.cjs +39 -0
  56. package/dist/parse-fXy5pbmE.d.mts +9 -0
  57. package/dist/parse-fXy5pbmE.d.mts.map +1 -0
  58. package/dist/parse-vw_qRD3F.mjs +81 -0
  59. package/dist/parse-vw_qRD3F.mjs.map +1 -0
  60. package/dist/pointer/find-reference.cjs +5 -65
  61. package/dist/pointer/find-reference.d.cts +2 -52
  62. package/dist/pointer/find-reference.d.mts +2 -52
  63. package/dist/pointer/find-reference.mjs +2 -63
  64. package/dist/pointer/index.cjs +15 -14
  65. package/dist/pointer/index.d.cts +2 -2
  66. package/dist/pointer/index.d.mts +2 -2
  67. package/dist/pointer/index.mjs +3 -2
  68. package/dist/pointer/parse.cjs +9 -86
  69. package/dist/pointer/parse.d.cts +2 -44
  70. package/dist/pointer/parse.d.mts +2 -44
  71. package/dist/pointer/parse.mjs +2 -80
  72. package/dist/pointer-B3W_Sme3.cjs +0 -0
  73. package/dist/pointer-Dn__XOdY.mjs +0 -0
  74. package/dist/schema-BO1HCrxv.d.cts +55 -0
  75. package/dist/schema-BO1HCrxv.d.cts.map +1 -0
  76. package/dist/schema-CmH1V_uI.d.mts +55 -0
  77. package/dist/schema-CmH1V_uI.d.mts.map +1 -0
  78. package/dist/schema-DGmzxHja.mjs +72 -0
  79. package/dist/schema-DGmzxHja.mjs.map +1 -0
  80. package/dist/schema-Dl018Aq4.cjs +106 -0
  81. package/dist/schema.cjs +8 -0
  82. package/dist/schema.d.cts +2 -0
  83. package/dist/schema.d.mts +3 -0
  84. package/dist/schema.mjs +3 -0
  85. package/dist/storm-json-8F9CKpXu.d.mts +70 -0
  86. package/dist/storm-json-8F9CKpXu.d.mts.map +1 -0
  87. package/dist/storm-json-BD6WFbrI.cjs +154 -0
  88. package/dist/storm-json-DvIEWMEH.d.cts +70 -0
  89. package/dist/storm-json-DvIEWMEH.d.cts.map +1 -0
  90. package/dist/storm-json-nkhJgTz4.mjs +116 -0
  91. package/dist/storm-json-nkhJgTz4.mjs.map +1 -0
  92. package/dist/storm-json.cjs +3 -116
  93. package/dist/storm-json.d.cts +2 -70
  94. package/dist/storm-json.d.mts +3 -70
  95. package/dist/storm-json.mjs +3 -115
  96. package/dist/stringify-Bc8OkhIr.d.cts +13 -0
  97. package/dist/stringify-Bc8OkhIr.d.cts.map +1 -0
  98. package/dist/stringify-BehjrfhS.cjs +78 -0
  99. package/dist/stringify-CFT1K1LE.d.mts +13 -0
  100. package/dist/stringify-CFT1K1LE.d.mts.map +1 -0
  101. package/dist/stringify-CYHjAvWm.mjs +68 -0
  102. package/dist/stringify-CYHjAvWm.mjs.map +1 -0
  103. package/dist/strip-comments-BA8MS_Fs.d.mts +11 -0
  104. package/dist/strip-comments-BA8MS_Fs.d.mts.map +1 -0
  105. package/dist/strip-comments-CmEG_smS.cjs +94 -0
  106. package/dist/strip-comments-Cz_Wc25t.d.cts +11 -0
  107. package/dist/strip-comments-Cz_Wc25t.d.cts.map +1 -0
  108. package/dist/strip-comments-Dq00N_Sg.mjs +89 -0
  109. package/dist/strip-comments-Dq00N_Sg.mjs.map +1 -0
  110. package/dist/types-Bn8rC098.d.cts +222 -0
  111. package/dist/types-Bn8rC098.d.cts.map +1 -0
  112. package/dist/types-CPQlxauZ.d.mts +222 -0
  113. package/dist/types-CPQlxauZ.d.mts.map +1 -0
  114. package/dist/types.d.cts +2 -69
  115. package/dist/types.d.mts +2 -69
  116. package/dist/types.mjs +0 -1
  117. package/dist/utils/code-frames.cjs +2 -76
  118. package/dist/utils/code-frames.d.cts +2 -17
  119. package/dist/utils/code-frames.d.mts +2 -17
  120. package/dist/utils/code-frames.mjs +2 -76
  121. package/dist/utils/index.cjs +13 -12
  122. package/dist/utils/index.d.cts +5 -5
  123. package/dist/utils/index.d.mts +6 -5
  124. package/dist/utils/index.mjs +6 -5
  125. package/dist/utils/parse-error.cjs +2 -33
  126. package/dist/utils/parse-error.d.cts +2 -15
  127. package/dist/utils/parse-error.d.mts +2 -15
  128. package/dist/utils/parse-error.mjs +2 -33
  129. package/dist/utils/parse.cjs +3 -51
  130. package/dist/utils/parse.d.cts +2 -9
  131. package/dist/utils/parse.d.mts +2 -9
  132. package/dist/utils/parse.mjs +2 -51
  133. package/dist/utils/stringify.cjs +3 -67
  134. package/dist/utils/stringify.d.cts +2 -13
  135. package/dist/utils/stringify.d.mts +2 -13
  136. package/dist/utils/stringify.mjs +2 -67
  137. package/dist/utils/strip-comments.cjs +2 -85
  138. package/dist/utils/strip-comments.d.cts +2 -11
  139. package/dist/utils/strip-comments.d.mts +2 -11
  140. package/dist/utils/strip-comments.mjs +2 -86
  141. package/dist/utils-jN2UkvqB.cjs +0 -0
  142. package/dist/utils-mEkKIcgl.mjs +0 -0
  143. package/package.json +12 -3
  144. package/dist/_virtual/rolldown_runtime.cjs +0 -29
  145. package/dist/pointer/find-reference.d.cts.map +0 -1
  146. package/dist/pointer/find-reference.d.mts.map +0 -1
  147. package/dist/pointer/find-reference.mjs.map +0 -1
  148. package/dist/pointer/parse.d.cts.map +0 -1
  149. package/dist/pointer/parse.d.mts.map +0 -1
  150. package/dist/pointer/parse.mjs.map +0 -1
  151. package/dist/storm-json.d.cts.map +0 -1
  152. package/dist/storm-json.d.mts.map +0 -1
  153. package/dist/storm-json.mjs.map +0 -1
  154. package/dist/type-checks/src/get-object-tag.cjs +0 -15
  155. package/dist/type-checks/src/get-object-tag.mjs +0 -15
  156. package/dist/type-checks/src/get-object-tag.mjs.map +0 -1
  157. package/dist/type-checks/src/is-empty.cjs +0 -20
  158. package/dist/type-checks/src/is-empty.mjs +0 -21
  159. package/dist/type-checks/src/is-empty.mjs.map +0 -1
  160. package/dist/type-checks/src/is-non-null-object.cjs +0 -16
  161. package/dist/type-checks/src/is-non-null-object.mjs +0 -17
  162. package/dist/type-checks/src/is-non-null-object.mjs.map +0 -1
  163. package/dist/type-checks/src/is-null.cjs +0 -12
  164. package/dist/type-checks/src/is-null.mjs +0 -12
  165. package/dist/type-checks/src/is-null.mjs.map +0 -1
  166. package/dist/type-checks/src/is-number.cjs +0 -18
  167. package/dist/type-checks/src/is-number.mjs +0 -18
  168. package/dist/type-checks/src/is-number.mjs.map +0 -1
  169. package/dist/type-checks/src/is-object.cjs +0 -19
  170. package/dist/type-checks/src/is-object.mjs +0 -20
  171. package/dist/type-checks/src/is-object.mjs.map +0 -1
  172. package/dist/type-checks/src/is-plain-object.mjs.map +0 -1
  173. package/dist/type-checks/src/is-set-object.cjs +0 -19
  174. package/dist/type-checks/src/is-set-object.mjs +0 -20
  175. package/dist/type-checks/src/is-set-object.mjs.map +0 -1
  176. package/dist/type-checks/src/is-set.cjs +0 -19
  177. package/dist/type-checks/src/is-set.mjs +0 -20
  178. package/dist/type-checks/src/is-set.mjs.map +0 -1
  179. package/dist/type-checks/src/is-string.mjs.map +0 -1
  180. package/dist/type-checks/src/is-undefined.mjs.map +0 -1
  181. package/dist/types/src/base.cjs +0 -6
  182. package/dist/types/src/base.mjs +0 -6
  183. package/dist/types/src/base.mjs.map +0 -1
  184. package/dist/types/src/json.d.cts +0 -12
  185. package/dist/types/src/json.d.cts.map +0 -1
  186. package/dist/types/src/json.d.mts +0 -12
  187. package/dist/types/src/json.d.mts.map +0 -1
  188. package/dist/types.d.cts.map +0 -1
  189. package/dist/types.d.mts.map +0 -1
  190. package/dist/utils/code-frames.d.cts.map +0 -1
  191. package/dist/utils/code-frames.d.mts.map +0 -1
  192. package/dist/utils/code-frames.mjs.map +0 -1
  193. package/dist/utils/parse-error.d.cts.map +0 -1
  194. package/dist/utils/parse-error.d.mts.map +0 -1
  195. package/dist/utils/parse-error.mjs.map +0 -1
  196. package/dist/utils/parse.d.cts.map +0 -1
  197. package/dist/utils/parse.d.mts.map +0 -1
  198. package/dist/utils/parse.mjs.map +0 -1
  199. package/dist/utils/stringify.d.cts.map +0 -1
  200. package/dist/utils/stringify.d.mts.map +0 -1
  201. package/dist/utils/stringify.mjs.map +0 -1
  202. package/dist/utils/strip-comments.d.cts.map +0 -1
  203. package/dist/utils/strip-comments.d.mts.map +0 -1
  204. package/dist/utils/strip-comments.mjs.map +0 -1
@@ -1,52 +1,2 @@
1
- //#region src/pointer/find-reference.d.ts
2
- interface Reference {
3
- /** Target value where pointer is pointing. */
4
- readonly val: unknown;
5
- /** Object which contains the target value. */
6
- readonly obj?: unknown | object | unknown[];
7
- /** Key which targets the target value in the object. */
8
- readonly key?: string | number;
9
- }
10
- /**
11
- * Finds a target in document specified by JSON Pointer. Also returns the
12
- * object containing the target and key used to reference that object.
13
- *
14
- * Throws Error('NOT_FOUND') if pointer does not result into a value in the middle
15
- * of the path. If the last element of the path does not result into a value, the
16
- * lookup succeeds with `val` set to `undefined`. It can be used to discriminate
17
- * missing values, because `undefined` is not a valid JSON value.
18
- *
19
- * If last element in array is targeted using "-", e.g. "/arr/-", use
20
- * `isArrayEnd` to verify that:
21
- *
22
- * ```js
23
- * const ref = find({arr: [1, 2, 3], ['arr', '-']});
24
- * if (isArrayReference(ref)) {
25
- * if (isArrayEnd(ref)) {
26
- * // ...
27
- * }
28
- * }
29
- * ```
30
- *
31
- * @param val - Document to search in.
32
- * @param path - JSON Pointer path.
33
- * @returns Reference to the target.
34
- */
35
- declare const find: (val: unknown, path: Reference["key"][]) => Reference;
36
- interface ArrayReference<T = unknown> {
37
- /** `undefined` in case JSON Pointer points to last element, e.g. "/foo/-". */
38
- readonly val: undefined | T;
39
- readonly obj: T[];
40
- readonly key: number;
41
- }
42
- declare const isArrayReference: <T = unknown>(ref: Reference) => ref is ArrayReference<T>;
43
- declare const isArrayEnd: (ref: ArrayReference) => boolean;
44
- interface ObjectReference<T = unknown> {
45
- readonly val: T;
46
- readonly obj: Record<string, T>;
47
- readonly key: string;
48
- }
49
- declare const isObjectReference: <T = unknown>(ref: Reference) => ref is ObjectReference<T>;
50
- //#endregion
51
- export { ArrayReference, ObjectReference, Reference, find, isArrayEnd, isArrayReference, isObjectReference };
52
- //# sourceMappingURL=find-reference.d.cts.map
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-C-YleCds.cjs";
2
+ export { ArrayReference, ObjectReference, Reference, find, isArrayEnd, isArrayReference, isObjectReference };
@@ -1,52 +1,2 @@
1
- //#region src/pointer/find-reference.d.ts
2
- interface Reference {
3
- /** Target value where pointer is pointing. */
4
- readonly val: unknown;
5
- /** Object which contains the target value. */
6
- readonly obj?: unknown | object | unknown[];
7
- /** Key which targets the target value in the object. */
8
- readonly key?: string | number;
9
- }
10
- /**
11
- * Finds a target in document specified by JSON Pointer. Also returns the
12
- * object containing the target and key used to reference that object.
13
- *
14
- * Throws Error('NOT_FOUND') if pointer does not result into a value in the middle
15
- * of the path. If the last element of the path does not result into a value, the
16
- * lookup succeeds with `val` set to `undefined`. It can be used to discriminate
17
- * missing values, because `undefined` is not a valid JSON value.
18
- *
19
- * If last element in array is targeted using "-", e.g. "/arr/-", use
20
- * `isArrayEnd` to verify that:
21
- *
22
- * ```js
23
- * const ref = find({arr: [1, 2, 3], ['arr', '-']});
24
- * if (isArrayReference(ref)) {
25
- * if (isArrayEnd(ref)) {
26
- * // ...
27
- * }
28
- * }
29
- * ```
30
- *
31
- * @param val - Document to search in.
32
- * @param path - JSON Pointer path.
33
- * @returns Reference to the target.
34
- */
35
- declare const find: (val: unknown, path: Reference["key"][]) => Reference;
36
- interface ArrayReference<T = unknown> {
37
- /** `undefined` in case JSON Pointer points to last element, e.g. "/foo/-". */
38
- readonly val: undefined | T;
39
- readonly obj: T[];
40
- readonly key: number;
41
- }
42
- declare const isArrayReference: <T = unknown>(ref: Reference) => ref is ArrayReference<T>;
43
- declare const isArrayEnd: (ref: ArrayReference) => boolean;
44
- interface ObjectReference<T = unknown> {
45
- readonly val: T;
46
- readonly obj: Record<string, T>;
47
- readonly key: string;
48
- }
49
- declare const isObjectReference: <T = unknown>(ref: Reference) => ref is ObjectReference<T>;
50
- //#endregion
51
- export { ArrayReference, ObjectReference, Reference, find, isArrayEnd, isArrayReference, isObjectReference };
52
- //# sourceMappingURL=find-reference.d.mts.map
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
+ export { ArrayReference, ObjectReference, Reference, find, isArrayEnd, isArrayReference, isObjectReference };
@@ -1,64 +1,3 @@
1
- import { isString } from "../type-checks/src/is-string.mjs";
2
- import { isSetObject } from "../type-checks/src/is-set-object.mjs";
1
+ import { i as isObjectReference, n as isArrayEnd, r as isArrayReference, t as find } from "../find-reference-DMSYEaaI.mjs";
3
2
 
4
- //#region src/pointer/find-reference.ts
5
- const { isArray } = Array;
6
- /**
7
- * Finds a target in document specified by JSON Pointer. Also returns the
8
- * object containing the target and key used to reference that object.
9
- *
10
- * Throws Error('NOT_FOUND') if pointer does not result into a value in the middle
11
- * of the path. If the last element of the path does not result into a value, the
12
- * lookup succeeds with `val` set to `undefined`. It can be used to discriminate
13
- * missing values, because `undefined` is not a valid JSON value.
14
- *
15
- * If last element in array is targeted using "-", e.g. "/arr/-", use
16
- * `isArrayEnd` to verify that:
17
- *
18
- * ```js
19
- * const ref = find({arr: [1, 2, 3], ['arr', '-']});
20
- * if (isArrayReference(ref)) {
21
- * if (isArrayEnd(ref)) {
22
- * // ...
23
- * }
24
- * }
25
- * ```
26
- *
27
- * @param val - Document to search in.
28
- * @param path - JSON Pointer path.
29
- * @returns Reference to the target.
30
- */
31
- const find = (val, path) => {
32
- const pathLength = path.length;
33
- if (!pathLength) return { val };
34
- let obj;
35
- let key;
36
- for (let i = 0; i < pathLength; i++) {
37
- obj = val;
38
- key = path[i];
39
- if (isArray(obj)) {
40
- const length = obj.length;
41
- if (key === "-") key = length;
42
- else if (isString(key)) {
43
- const key2 = Math.trunc(Number.parseInt(key));
44
- if (String(key2) !== key) throw new Error("INVALID_INDEX");
45
- key = key2;
46
- if (key < 0) throw new Error("INVALID_INDEX");
47
- }
48
- if (key) val = obj[key];
49
- } else if (isSetObject(obj)) val = key && key in obj ? obj[key] : void 0;
50
- else throw new Error("NOT_FOUND");
51
- }
52
- return {
53
- val,
54
- obj,
55
- key
56
- };
57
- };
58
- const isArrayReference = (ref) => isArray(ref.obj) && typeof ref.key === "number";
59
- const isArrayEnd = (ref) => ref.obj.length === ref.key;
60
- const isObjectReference = (ref) => typeof ref.obj === "object" && typeof ref.key === "string";
61
-
62
- //#endregion
63
- export { find, isArrayEnd, isArrayReference, isObjectReference };
64
- //# sourceMappingURL=find-reference.mjs.map
3
+ export { find, isArrayEnd, isArrayReference, isObjectReference };
@@ -1,15 +1,16 @@
1
- const require_pointer_find_reference = require('./find-reference.cjs');
2
- const require_pointer_parse = require('./parse.cjs');
1
+ const require_find_reference = require('../find-reference-De5vBQV2.cjs');
2
+ const require_parse = require('../parse-Bp6kkcQ4.cjs');
3
+ require('../pointer-B3W_Sme3.cjs');
3
4
 
4
- exports.escapePointerSegment = require_pointer_parse.escapePointerSegment;
5
- exports.find = require_pointer_find_reference.find;
6
- exports.formatJsonPointer = require_pointer_parse.formatJsonPointer;
7
- exports.isArrayEnd = require_pointer_find_reference.isArrayEnd;
8
- exports.isArrayReference = require_pointer_find_reference.isArrayReference;
9
- exports.isInteger = require_pointer_parse.isInteger;
10
- exports.isObjectReference = require_pointer_find_reference.isObjectReference;
11
- exports.isRoot = require_pointer_parse.isRoot;
12
- exports.isValidIndex = require_pointer_parse.isValidIndex;
13
- exports.parent = require_pointer_parse.parent;
14
- exports.parseJsonPointer = require_pointer_parse.parseJsonPointer;
15
- exports.unescapePointerSegment = require_pointer_parse.unescapePointerSegment;
5
+ exports.escapePointerSegment = require_parse.escapePointerSegment;
6
+ exports.find = require_find_reference.find;
7
+ exports.formatJsonPointer = require_parse.formatJsonPointer;
8
+ exports.isArrayEnd = require_find_reference.isArrayEnd;
9
+ exports.isArrayReference = require_find_reference.isArrayReference;
10
+ exports.isInteger = require_parse.isInteger;
11
+ exports.isObjectReference = require_find_reference.isObjectReference;
12
+ exports.isRoot = require_parse.isRoot;
13
+ exports.isValidIndex = require_parse.isValidIndex;
14
+ exports.parent = require_parse.parent;
15
+ exports.parseJsonPointer = require_parse.parseJsonPointer;
16
+ exports.unescapePointerSegment = require_parse.unescapePointerSegment;
@@ -1,3 +1,3 @@
1
- import { ArrayReference, ObjectReference, Reference, find, isArrayEnd, isArrayReference, isObjectReference } from "./find-reference.cjs";
2
- import { escapePointerSegment, formatJsonPointer, isInteger, isRoot, isValidIndex, parent, parseJsonPointer, unescapePointerSegment } from "./parse.cjs";
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-C-YleCds.cjs";
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-DZfi3d96.cjs";
3
3
  export { ArrayReference, ObjectReference, Reference, escapePointerSegment, find, formatJsonPointer, isArrayEnd, isArrayReference, isInteger, isObjectReference, isRoot, isValidIndex, parent, parseJsonPointer, unescapePointerSegment };
@@ -1,3 +1,3 @@
1
- import { ArrayReference, ObjectReference, Reference, find, isArrayEnd, isArrayReference, isObjectReference } from "./find-reference.mjs";
2
- import { escapePointerSegment, formatJsonPointer, isInteger, isRoot, isValidIndex, parent, parseJsonPointer, unescapePointerSegment } from "./parse.mjs";
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
3
  export { ArrayReference, ObjectReference, Reference, escapePointerSegment, find, formatJsonPointer, isArrayEnd, isArrayReference, isInteger, isObjectReference, isRoot, isValidIndex, parent, parseJsonPointer, unescapePointerSegment };
@@ -1,4 +1,5 @@
1
- import { find, isArrayEnd, isArrayReference, isObjectReference } from "./find-reference.mjs";
2
- import { escapePointerSegment, formatJsonPointer, isInteger, isRoot, isValidIndex, parent, parseJsonPointer, unescapePointerSegment } from "./parse.mjs";
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";
3
4
 
4
5
  export { escapePointerSegment, find, formatJsonPointer, isArrayEnd, isArrayReference, isInteger, isObjectReference, isRoot, isValidIndex, parent, parseJsonPointer, unescapePointerSegment };
@@ -1,87 +1,10 @@
1
- const require_is_string = require('../type-checks/src/is-string.cjs');
2
- const require_is_number = require('../type-checks/src/is-number.cjs');
1
+ const require_parse = require('../parse-Bp6kkcQ4.cjs');
3
2
 
4
- //#region src/pointer/parse.ts
5
- const TILDE_ONE = /~1/g;
6
- const TILDE_ZERO = /~0/g;
7
- const TILDE = /~/g;
8
- const FORWARD_SLASH = /\//g;
9
- /**
10
- * Escapes a JSON pointer path segment.
11
- *
12
- * @param segment - JSON pointer path segment.
13
- * @returns Escaped JSON pointer path segment.
14
- */
15
- function escapePointerSegment(segment) {
16
- if (!segment.includes("/") && !segment.includes("~")) return segment;
17
- return segment.replace(TILDE, "~0").replace(FORWARD_SLASH, "~1");
18
- }
19
- /**
20
- * Unescapes a JSON pointer path segment.
21
- *
22
- * @param segment - JSON pointer path segment.
23
- * @returns Unescaped JSON pointer path segment.
24
- */
25
- function unescapePointerSegment(segment) {
26
- if (!segment.includes("~")) return segment;
27
- return segment.replace(TILDE_ONE, "/").replace(TILDE_ZERO, "~");
28
- }
29
- /**
30
- * Convert JSON pointer like "/foo/bar" to array like ["", "foo", "bar"], while
31
- * also un-escaping reserved characters.
32
- */
33
- function parseJsonPointer(pointer) {
34
- if (!pointer) return [];
35
- return pointer.slice(1).split("/").map((segment) => unescapePointerSegment(segment));
36
- }
37
- /**
38
- * Escape and format a path array like ["", "foo", "bar"] to JSON pointer
39
- * like "/foo/bar".
40
- */
41
- function formatJsonPointer(path) {
42
- if (isRoot(path)) return "";
43
- return `/${path.map((segment) => escapePointerSegment(String(segment))).join("/")}`;
44
- }
45
- /**
46
- * Returns true if JSON Pointer points to root value, false otherwise.
47
- */
48
- const isRoot = (path) => require_is_string.isString(path) ? path === "" : require_is_number.isNumber(path) ? path === 0 : Array.isArray(path) && path.length === 0;
49
- /**
50
- * Returns parent path, e.g. for ['foo', 'bar', 'baz'] returns ['foo', 'bar'].
51
- */
52
- function parent(path) {
53
- if (path.length === 0) throw new Error("NO_PARENT");
54
- return path.slice(0, -1);
55
- }
56
- /**
57
- * Check if path component can be a valid array index.
58
- */
59
- function isValidIndex(index) {
60
- if (require_is_number.isNumber(index)) return true;
61
- const n = Number.parseInt(index, 10);
62
- return String(n) === index && n >= 0;
63
- }
64
- const isInteger = (str) => {
65
- const len = str.length;
66
- let i = 0;
67
- let charCode;
68
- while (i < len) {
69
- charCode = str.codePointAt(i);
70
- if (charCode >= 48 && charCode <= 57) {
71
- i++;
72
- continue;
73
- }
74
- return false;
75
- }
76
- return true;
77
- };
78
-
79
- //#endregion
80
- exports.escapePointerSegment = escapePointerSegment;
81
- exports.formatJsonPointer = formatJsonPointer;
82
- exports.isInteger = isInteger;
83
- exports.isRoot = isRoot;
84
- exports.isValidIndex = isValidIndex;
85
- exports.parent = parent;
86
- exports.parseJsonPointer = parseJsonPointer;
87
- exports.unescapePointerSegment = unescapePointerSegment;
3
+ exports.escapePointerSegment = require_parse.escapePointerSegment;
4
+ exports.formatJsonPointer = require_parse.formatJsonPointer;
5
+ exports.isInteger = require_parse.isInteger;
6
+ exports.isRoot = require_parse.isRoot;
7
+ exports.isValidIndex = require_parse.isValidIndex;
8
+ exports.parent = require_parse.parent;
9
+ exports.parseJsonPointer = require_parse.parseJsonPointer;
10
+ exports.unescapePointerSegment = require_parse.unescapePointerSegment;
@@ -1,44 +1,2 @@
1
- import { JsonPointerPath } from "../types/src/json.cjs";
2
-
3
- //#region src/pointer/parse.d.ts
4
-
5
- /**
6
- * Escapes a JSON pointer path segment.
7
- *
8
- * @param segment - JSON pointer path segment.
9
- * @returns Escaped JSON pointer path segment.
10
- */
11
- declare function escapePointerSegment(segment: string): string;
12
- /**
13
- * Unescapes a JSON pointer path segment.
14
- *
15
- * @param segment - JSON pointer path segment.
16
- * @returns Unescaped JSON pointer path segment.
17
- */
18
- declare function unescapePointerSegment(segment: string): string;
19
- /**
20
- * Convert JSON pointer like "/foo/bar" to array like ["", "foo", "bar"], while
21
- * also un-escaping reserved characters.
22
- */
23
- declare function parseJsonPointer(pointer: string): JsonPointerPath;
24
- /**
25
- * Escape and format a path array like ["", "foo", "bar"] to JSON pointer
26
- * like "/foo/bar".
27
- */
28
- declare function formatJsonPointer(path: JsonPointerPath): string;
29
- /**
30
- * Returns true if JSON Pointer points to root value, false otherwise.
31
- */
32
- declare const isRoot: (path: string | number | JsonPointerPath) => boolean;
33
- /**
34
- * Returns parent path, e.g. for ['foo', 'bar', 'baz'] returns ['foo', 'bar'].
35
- */
36
- declare function parent(path: JsonPointerPath): JsonPointerPath;
37
- /**
38
- * Check if path component can be a valid array index.
39
- */
40
- declare function isValidIndex(index: string | number): boolean;
41
- declare const isInteger: (str: string) => boolean;
42
- //#endregion
43
- export { escapePointerSegment, formatJsonPointer, isInteger, isRoot, isValidIndex, parent, parseJsonPointer, unescapePointerSegment };
44
- //# sourceMappingURL=parse.d.cts.map
1
+ 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-DZfi3d96.cjs";
2
+ export { escapePointerSegment, formatJsonPointer, isInteger, isRoot, isValidIndex, parent, parseJsonPointer, unescapePointerSegment };
@@ -1,44 +1,2 @@
1
- import { JsonPointerPath } from "../types/src/json.mjs";
2
-
3
- //#region src/pointer/parse.d.ts
4
-
5
- /**
6
- * Escapes a JSON pointer path segment.
7
- *
8
- * @param segment - JSON pointer path segment.
9
- * @returns Escaped JSON pointer path segment.
10
- */
11
- declare function escapePointerSegment(segment: string): string;
12
- /**
13
- * Unescapes a JSON pointer path segment.
14
- *
15
- * @param segment - JSON pointer path segment.
16
- * @returns Unescaped JSON pointer path segment.
17
- */
18
- declare function unescapePointerSegment(segment: string): string;
19
- /**
20
- * Convert JSON pointer like "/foo/bar" to array like ["", "foo", "bar"], while
21
- * also un-escaping reserved characters.
22
- */
23
- declare function parseJsonPointer(pointer: string): JsonPointerPath;
24
- /**
25
- * Escape and format a path array like ["", "foo", "bar"] to JSON pointer
26
- * like "/foo/bar".
27
- */
28
- declare function formatJsonPointer(path: JsonPointerPath): string;
29
- /**
30
- * Returns true if JSON Pointer points to root value, false otherwise.
31
- */
32
- declare const isRoot: (path: string | number | JsonPointerPath) => boolean;
33
- /**
34
- * Returns parent path, e.g. for ['foo', 'bar', 'baz'] returns ['foo', 'bar'].
35
- */
36
- declare function parent(path: JsonPointerPath): JsonPointerPath;
37
- /**
38
- * Check if path component can be a valid array index.
39
- */
40
- declare function isValidIndex(index: string | number): boolean;
41
- declare const isInteger: (str: string) => boolean;
42
- //#endregion
43
- export { escapePointerSegment, formatJsonPointer, isInteger, isRoot, isValidIndex, parent, parseJsonPointer, unescapePointerSegment };
44
- //# sourceMappingURL=parse.d.mts.map
1
+ 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";
2
+ export { escapePointerSegment, formatJsonPointer, isInteger, isRoot, isValidIndex, parent, parseJsonPointer, unescapePointerSegment };
@@ -1,81 +1,3 @@
1
- import { isString } from "../type-checks/src/is-string.mjs";
2
- import { isNumber } from "../type-checks/src/is-number.mjs";
1
+ 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
2
 
4
- //#region src/pointer/parse.ts
5
- const TILDE_ONE = /~1/g;
6
- const TILDE_ZERO = /~0/g;
7
- const TILDE = /~/g;
8
- const FORWARD_SLASH = /\//g;
9
- /**
10
- * Escapes a JSON pointer path segment.
11
- *
12
- * @param segment - JSON pointer path segment.
13
- * @returns Escaped JSON pointer path segment.
14
- */
15
- function escapePointerSegment(segment) {
16
- if (!segment.includes("/") && !segment.includes("~")) return segment;
17
- return segment.replace(TILDE, "~0").replace(FORWARD_SLASH, "~1");
18
- }
19
- /**
20
- * Unescapes a JSON pointer path segment.
21
- *
22
- * @param segment - JSON pointer path segment.
23
- * @returns Unescaped JSON pointer path segment.
24
- */
25
- function unescapePointerSegment(segment) {
26
- if (!segment.includes("~")) return segment;
27
- return segment.replace(TILDE_ONE, "/").replace(TILDE_ZERO, "~");
28
- }
29
- /**
30
- * Convert JSON pointer like "/foo/bar" to array like ["", "foo", "bar"], while
31
- * also un-escaping reserved characters.
32
- */
33
- function parseJsonPointer(pointer) {
34
- if (!pointer) return [];
35
- return pointer.slice(1).split("/").map((segment) => unescapePointerSegment(segment));
36
- }
37
- /**
38
- * Escape and format a path array like ["", "foo", "bar"] to JSON pointer
39
- * like "/foo/bar".
40
- */
41
- function formatJsonPointer(path) {
42
- if (isRoot(path)) return "";
43
- return `/${path.map((segment) => escapePointerSegment(String(segment))).join("/")}`;
44
- }
45
- /**
46
- * Returns true if JSON Pointer points to root value, false otherwise.
47
- */
48
- const isRoot = (path) => isString(path) ? path === "" : isNumber(path) ? path === 0 : Array.isArray(path) && path.length === 0;
49
- /**
50
- * Returns parent path, e.g. for ['foo', 'bar', 'baz'] returns ['foo', 'bar'].
51
- */
52
- function parent(path) {
53
- if (path.length === 0) throw new Error("NO_PARENT");
54
- return path.slice(0, -1);
55
- }
56
- /**
57
- * Check if path component can be a valid array index.
58
- */
59
- function isValidIndex(index) {
60
- if (isNumber(index)) return true;
61
- const n = Number.parseInt(index, 10);
62
- return String(n) === index && n >= 0;
63
- }
64
- const isInteger = (str) => {
65
- const len = str.length;
66
- let i = 0;
67
- let charCode;
68
- while (i < len) {
69
- charCode = str.codePointAt(i);
70
- if (charCode >= 48 && charCode <= 57) {
71
- i++;
72
- continue;
73
- }
74
- return false;
75
- }
76
- return true;
77
- };
78
-
79
- //#endregion
80
- export { escapePointerSegment, formatJsonPointer, isInteger, isRoot, isValidIndex, parent, parseJsonPointer, unescapePointerSegment };
81
- //# sourceMappingURL=parse.mjs.map
3
+ export { escapePointerSegment, formatJsonPointer, isInteger, isRoot, isValidIndex, parent, parseJsonPointer, unescapePointerSegment };
File without changes
File without changes
@@ -0,0 +1,55 @@
1
+ import { A as JsonSchema7PrimitiveLiteralType, I as JsonSchema7StringType, O as JsonSchema7ObjectType, R as JsonSchema7Type, b as JsonSchema7LiteralType, f as JsonSchema7AllOfType, h as JsonSchema7ArrayType } from "./types-Bn8rC098.cjs";
2
+ import { StandardJSONSchemaV1 } from "@standard-schema/spec";
3
+
4
+ //#region src/schema.d.ts
5
+
6
+ /**
7
+ * Type guard for {@link JsonSchema7AllOfType}
8
+ *
9
+ * @param schema - The schema to check
10
+ * @returns True if the schema is a {@link JsonSchema7AllOfType}, false otherwise
11
+ */
12
+ declare function isJsonSchema7AllOfType(schema: JsonSchema7Type | JsonSchema7StringType): schema is JsonSchema7AllOfType;
13
+ /**
14
+ * Type guard for {@link JsonSchema7ObjectType}
15
+ *
16
+ * @param schema - The schema to check
17
+ * @returns True if the schema is a {@link JsonSchema7ObjectType}, false otherwise
18
+ */
19
+ declare function isJsonSchema7ObjectType(schema: JsonSchema7Type | JsonSchema7StringType): schema is JsonSchema7ObjectType;
20
+ /**
21
+ * Type guard for {@link JsonSchema7ArrayType}
22
+ *
23
+ * @param schema - The schema to check
24
+ * @returns True if the schema is a {@link JsonSchema7ArrayType}, false otherwise
25
+ */
26
+ declare function isJsonSchema7ArrayType(schema: JsonSchema7Type): schema is JsonSchema7ArrayType;
27
+ /**
28
+ * Type guard for {@link JsonSchema7PrimitiveLiteralType}
29
+ *
30
+ * @param schema - The schema to check
31
+ * @returns True if the schema is a {@link JsonSchema7PrimitiveLiteralType}, false otherwise
32
+ */
33
+ declare function isJsonSchema7PrimitiveLiteralType(schema: JsonSchema7Type): schema is JsonSchema7PrimitiveLiteralType;
34
+ /**
35
+ * Type guard for {@link JsonSchema7LiteralType}
36
+ *
37
+ * @param schema - The schema to check
38
+ * @returns True if the schema is a {@link JsonSchema7LiteralType}, false otherwise
39
+ */
40
+ declare function isJsonSchema7LiteralType(schema: JsonSchema7Type): schema is JsonSchema7LiteralType;
41
+ /**
42
+ * Type guard to check if a value is a {@link StandardJSONSchemaV1 | Standard JSON Schema}.
43
+ *
44
+ * @remarks
45
+ * This function checks if the value has the structure of a Standard JSON Schema, which includes a `~standard` property with a `jsonSchema` object that has `input` and `output` functions.
46
+ *
47
+ * @see https://standardschema.dev/json-schema
48
+ *
49
+ * @param value - The value to check.
50
+ * @returns True if the value is a {@link StandardJSONSchemaV1 | Standard JSON Schema}, false otherwise.
51
+ */
52
+ declare function isStandardJsonSchema<Input = unknown, Output = Input>(value: any): value is StandardJSONSchemaV1<Input, Output>;
53
+ //#endregion
54
+ export { isJsonSchema7PrimitiveLiteralType as a, isJsonSchema7ObjectType as i, isJsonSchema7ArrayType as n, isStandardJsonSchema as o, isJsonSchema7LiteralType as r, isJsonSchema7AllOfType as t };
55
+ //# sourceMappingURL=schema-BO1HCrxv.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-BO1HCrxv.d.cts","names":[],"sources":["../src/schema.ts"],"sourcesContent":[],"mappings":";;;;;;;AAqCA;;;;AAEiC,iBAFjB,sBAAA,CAEiB,MAAA,EADvB,eACuB,GADL,qBACK,CAAA,EAAA,MAAA,IAApB,oBAAoB;AAcjC;;;;;AAgBA;AAYgB,iBA5BA,uBAAA,CA4BiC,MACvC,EA5BA,eA6BG,GA7Be,qBA6Bf,CAAA,EAAA,MAA+B,IA5B/B,qBA4B+B;AAsB5C;AAyBA;;;;;AAEgC,iBA/DhB,sBAAA,CA+DgB,MAAA,EA9DtB,eA8DsB,CAAA,EAAA,MAAA,IA7DnB,oBA6DmB;;;;;;;iBAnDhB,iCAAA,SACN,4BACG;;;;;;;iBAsBG,wBAAA,SACN,4BACG;;;;;;;;;;;;iBAuBG,+CAA+C,6BAEnD,qBAAqB,OAAO"}
@@ -0,0 +1,55 @@
1
+ import { A as JsonSchema7PrimitiveLiteralType, I as JsonSchema7StringType, O as JsonSchema7ObjectType, R as JsonSchema7Type, b as JsonSchema7LiteralType, f as JsonSchema7AllOfType, h as JsonSchema7ArrayType } from "./types-CPQlxauZ.mjs";
2
+ import { StandardJSONSchemaV1 } from "@standard-schema/spec";
3
+
4
+ //#region src/schema.d.ts
5
+
6
+ /**
7
+ * Type guard for {@link JsonSchema7AllOfType}
8
+ *
9
+ * @param schema - The schema to check
10
+ * @returns True if the schema is a {@link JsonSchema7AllOfType}, false otherwise
11
+ */
12
+ declare function isJsonSchema7AllOfType(schema: JsonSchema7Type | JsonSchema7StringType): schema is JsonSchema7AllOfType;
13
+ /**
14
+ * Type guard for {@link JsonSchema7ObjectType}
15
+ *
16
+ * @param schema - The schema to check
17
+ * @returns True if the schema is a {@link JsonSchema7ObjectType}, false otherwise
18
+ */
19
+ declare function isJsonSchema7ObjectType(schema: JsonSchema7Type | JsonSchema7StringType): schema is JsonSchema7ObjectType;
20
+ /**
21
+ * Type guard for {@link JsonSchema7ArrayType}
22
+ *
23
+ * @param schema - The schema to check
24
+ * @returns True if the schema is a {@link JsonSchema7ArrayType}, false otherwise
25
+ */
26
+ declare function isJsonSchema7ArrayType(schema: JsonSchema7Type): schema is JsonSchema7ArrayType;
27
+ /**
28
+ * Type guard for {@link JsonSchema7PrimitiveLiteralType}
29
+ *
30
+ * @param schema - The schema to check
31
+ * @returns True if the schema is a {@link JsonSchema7PrimitiveLiteralType}, false otherwise
32
+ */
33
+ declare function isJsonSchema7PrimitiveLiteralType(schema: JsonSchema7Type): schema is JsonSchema7PrimitiveLiteralType;
34
+ /**
35
+ * Type guard for {@link JsonSchema7LiteralType}
36
+ *
37
+ * @param schema - The schema to check
38
+ * @returns True if the schema is a {@link JsonSchema7LiteralType}, false otherwise
39
+ */
40
+ declare function isJsonSchema7LiteralType(schema: JsonSchema7Type): schema is JsonSchema7LiteralType;
41
+ /**
42
+ * Type guard to check if a value is a {@link StandardJSONSchemaV1 | Standard JSON Schema}.
43
+ *
44
+ * @remarks
45
+ * This function checks if the value has the structure of a Standard JSON Schema, which includes a `~standard` property with a `jsonSchema` object that has `input` and `output` functions.
46
+ *
47
+ * @see https://standardschema.dev/json-schema
48
+ *
49
+ * @param value - The value to check.
50
+ * @returns True if the value is a {@link StandardJSONSchemaV1 | Standard JSON Schema}, false otherwise.
51
+ */
52
+ declare function isStandardJsonSchema<Input = unknown, Output = Input>(value: any): value is StandardJSONSchemaV1<Input, Output>;
53
+ //#endregion
54
+ export { isJsonSchema7PrimitiveLiteralType as a, isJsonSchema7ObjectType as i, isJsonSchema7ArrayType as n, isStandardJsonSchema as o, isJsonSchema7LiteralType as r, isJsonSchema7AllOfType as t };
55
+ //# sourceMappingURL=schema-CmH1V_uI.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-CmH1V_uI.d.mts","names":[],"sources":["../src/schema.ts"],"sourcesContent":[],"mappings":";;;;;;;AAqCA;;;;AAEiC,iBAFjB,sBAAA,CAEiB,MAAA,EADvB,eACuB,GADL,qBACK,CAAA,EAAA,MAAA,IAApB,oBAAoB;AAcjC;;;;;AAgBA;AAYgB,iBA5BA,uBAAA,CA4BiC,MACvC,EA5BA,eA6BG,GA7Be,qBA6Bf,CAAA,EAAA,MAA+B,IA5B/B,qBA4B+B;AAsB5C;AAyBA;;;;;AAEgC,iBA/DhB,sBAAA,CA+DgB,MAAA,EA9DtB,eA8DsB,CAAA,EAAA,MAAA,IA7DnB,oBA6DmB;;;;;;;iBAnDhB,iCAAA,SACN,4BACG;;;;;;;iBAsBG,wBAAA,SACN,4BACG;;;;;;;;;;;;iBAuBG,+CAA+C,6BAEnD,qBAAqB,OAAO"}