@stryke/json 0.9.16 → 0.9.24
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 +411 -0
- package/README.md +18 -9
- package/dist/code-frames-BQI7PKd_.mjs +4 -0
- package/dist/code-frames-BQI7PKd_.mjs.map +1 -0
- package/dist/code-frames-CXX37tnR.d.mts +17 -0
- package/dist/code-frames-CXX37tnR.d.mts.map +1 -0
- package/dist/code-frames-DEWi5iIn.cjs +3 -0
- package/dist/code-frames-DViwqU8S.d.cts +17 -0
- package/dist/code-frames-DViwqU8S.d.cts.map +1 -0
- package/dist/find-reference-AvNORSzC.d.mts +52 -0
- package/dist/find-reference-AvNORSzC.d.mts.map +1 -0
- package/dist/find-reference-BUIYIOS4.mjs +2 -0
- package/dist/find-reference-BUIYIOS4.mjs.map +1 -0
- package/dist/find-reference-ChoPoDcB.d.cts +52 -0
- package/dist/find-reference-ChoPoDcB.d.cts.map +1 -0
- package/dist/find-reference-DQJK1LbJ.cjs +1 -0
- package/dist/index-CMuRFTR3.d.mts +1 -0
- package/dist/index-uTS5iDq_.d.cts +1 -0
- package/dist/index.cjs +1 -38
- package/dist/index.d.cts +8 -0
- package/dist/index.d.mts +9 -0
- package/dist/index.mjs +1 -1
- package/dist/is-number-CebQk_B0.mjs +2 -0
- package/dist/is-number-CebQk_B0.mjs.map +1 -0
- package/dist/is-number-wfNPC3Mj.cjs +1 -0
- package/dist/is-object-CGB7EeiA.cjs +1 -0
- package/dist/is-object-DDPbtSWR.mjs +2 -0
- package/dist/is-object-DDPbtSWR.mjs.map +1 -0
- package/dist/is-string-D5yKZC0U.cjs +1 -0
- package/dist/is-string-VB7nGKjX.mjs +2 -0
- package/dist/is-string-VB7nGKjX.mjs.map +1 -0
- package/dist/is-undefined-D6sfLkFq.mjs +2 -0
- package/dist/is-undefined-D6sfLkFq.mjs.map +1 -0
- package/dist/is-undefined-Pevixi0g.cjs +1 -0
- package/dist/parse-BYhuR8fo.mjs +2 -0
- package/dist/parse-BYhuR8fo.mjs.map +1 -0
- package/dist/parse-BpylFCf0.mjs +2 -0
- package/dist/parse-BpylFCf0.mjs.map +1 -0
- package/dist/parse-BwhwGAkA.cjs +1 -0
- package/dist/parse-D-7TqXVh.d.mts +51 -0
- package/dist/parse-D-7TqXVh.d.mts.map +1 -0
- package/dist/parse-DU-kIQN6.d.cts +51 -0
- package/dist/parse-DU-kIQN6.d.cts.map +1 -0
- package/dist/parse-DmriuGKI.cjs +1 -0
- package/dist/parse-error-0BAtatMf.cjs +1 -0
- package/dist/parse-error-CJTV0jdn.d.mts +15 -0
- package/dist/parse-error-CJTV0jdn.d.mts.map +1 -0
- package/dist/parse-error-DLuqEXmf.d.cts +15 -0
- package/dist/parse-error-DLuqEXmf.d.cts.map +1 -0
- package/dist/parse-error-DrJJkemH.mjs +2 -0
- package/dist/parse-error-DrJJkemH.mjs.map +1 -0
- package/dist/parse-fX7NFKdt.d.cts +9 -0
- package/dist/parse-fX7NFKdt.d.cts.map +1 -0
- package/dist/parse-xFkFesIF.d.mts +9 -0
- package/dist/parse-xFkFesIF.d.mts.map +1 -0
- package/dist/pointer/find-reference.cjs +1 -39
- package/dist/pointer/find-reference.d.cts +2 -0
- package/dist/pointer/find-reference.d.mts +2 -0
- package/dist/pointer/find-reference.mjs +1 -1
- package/dist/pointer/index.cjs +1 -27
- package/dist/pointer/index.d.cts +3 -0
- package/dist/pointer/index.d.mts +3 -0
- package/dist/pointer/index.mjs +1 -1
- package/dist/pointer/parse.cjs +1 -55
- package/dist/pointer/parse.d.cts +2 -0
- package/dist/pointer/parse.d.mts +2 -0
- package/dist/pointer/parse.mjs +1 -1
- package/dist/storm-json-BsdLpzM_.mjs +2 -0
- package/dist/storm-json-BsdLpzM_.mjs.map +1 -0
- package/dist/storm-json-CfqJ0KzG.d.mts +70 -0
- package/dist/storm-json-CfqJ0KzG.d.mts.map +1 -0
- package/dist/storm-json-DBxiMujR.cjs +1 -0
- package/dist/storm-json-Q1bOIv3-.d.cts +70 -0
- package/dist/storm-json-Q1bOIv3-.d.cts.map +1 -0
- package/dist/storm-json.cjs +1 -72
- package/dist/storm-json.d.cts +2 -0
- package/dist/storm-json.d.mts +3 -0
- package/dist/storm-json.mjs +1 -1
- package/dist/stringify-BpBMOhle.d.cts +13 -0
- package/dist/stringify-BpBMOhle.d.cts.map +1 -0
- package/dist/stringify-DjBDt8SC.mjs +2 -0
- package/dist/stringify-DjBDt8SC.mjs.map +1 -0
- package/dist/stringify-Dp0lF-wN.cjs +1 -0
- package/dist/stringify-ln223ZC9.d.mts +13 -0
- package/dist/stringify-ln223ZC9.d.mts.map +1 -0
- package/dist/strip-comments-BhdK_E8s.cjs +4 -0
- package/dist/strip-comments-CKLSXchM.d.cts +11 -0
- package/dist/strip-comments-CKLSXchM.d.cts.map +1 -0
- package/dist/strip-comments-DdsCzji6.d.mts +11 -0
- package/dist/strip-comments-DdsCzji6.d.mts.map +1 -0
- package/dist/strip-comments-LcqiBhvo.mjs +5 -0
- package/dist/strip-comments-LcqiBhvo.mjs.map +1 -0
- package/dist/types-CEiKQHlk.d.cts +69 -0
- package/dist/types-CEiKQHlk.d.cts.map +1 -0
- package/dist/types-CQHq94S4.d.mts +69 -0
- package/dist/types-CQHq94S4.d.mts.map +1 -0
- package/dist/types.cjs +0 -1
- package/dist/types.d.cts +2 -0
- package/dist/types.d.mts +2 -0
- package/dist/types.mjs +1 -0
- package/dist/utils/code-frames.cjs +1 -72
- package/dist/utils/code-frames.d.cts +2 -0
- package/dist/utils/code-frames.d.mts +2 -0
- package/dist/utils/code-frames.mjs +1 -3
- package/dist/utils/index.cjs +1 -60
- package/dist/utils/index.d.cts +6 -0
- package/dist/utils/index.d.mts +7 -0
- package/dist/utils/index.mjs +1 -1
- package/dist/utils/parse-error.cjs +1 -31
- package/dist/utils/parse-error.d.cts +2 -0
- package/dist/utils/parse-error.d.mts +2 -0
- package/dist/utils/parse-error.mjs +1 -3
- package/dist/utils/parse.cjs +1 -59
- package/dist/utils/parse.d.cts +2 -0
- package/dist/utils/parse.d.mts +2 -0
- package/dist/utils/parse.mjs +1 -1
- package/dist/utils/stringify.cjs +1 -42
- package/dist/utils/stringify.d.cts +2 -0
- package/dist/utils/stringify.d.mts +2 -0
- package/dist/utils/stringify.mjs +1 -1
- package/dist/utils/strip-comments.cjs +1 -43
- package/dist/utils/strip-comments.d.cts +2 -0
- package/dist/utils/strip-comments.d.mts +2 -0
- package/dist/utils/strip-comments.mjs +1 -4
- package/dist/utils-BkLHzBxb.mjs +1 -0
- package/dist/utils-DFU9Wltn.cjs +0 -0
- package/package.json +44 -238
- package/dist/index.d.ts +0 -11
- package/dist/pointer/find-reference.d.ts +0 -48
- package/dist/pointer/index.d.ts +0 -2
- package/dist/pointer/parse.d.ts +0 -38
- package/dist/storm-json.d.ts +0 -64
- package/dist/types.d.ts +0 -64
- package/dist/utils/code-frames.d.ts +0 -14
- package/dist/utils/index.d.ts +0 -5
- package/dist/utils/parse-error.d.ts +0 -9
- package/dist/utils/parse.d.ts +0 -5
- package/dist/utils/stringify.d.ts +0 -9
- package/dist/utils/strip-comments.d.ts +0 -4
|
@@ -0,0 +1,52 @@
|
|
|
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 { 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-ChoPoDcB.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-reference-ChoPoDcB.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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./is-object-CGB7EeiA.cjs`),t=require(`./is-string-D5yKZC0U.cjs`),n=require(`./is-undefined-Pevixi0g.cjs`),r=e=>{try{return e===null}catch{return!1}},i=e=>{try{return n.t(e)||r(e)}catch{return!1}},a=e=>{try{return!i(e)}catch{return!1}},o=t=>a(t)&&e.t(t),s=e=>{try{return o(e)&&Object.keys(e).length>0}catch{return!1}},{isArray:c}=Array,l=(e,n)=>{let r=n.length;if(!r)return{val:e};let i,a;for(let o=0;o<r;o++)if(i=e,a=n[o],c(i)){let n=i.length;if(a===`-`)a=n;else if(t.t(a)){let e=Math.trunc(Number.parseInt(a));if(String(e)!==a||(a=e,a<0))throw Error(`INVALID_INDEX`)}a&&(e=i[a])}else if(s(i))e=a&&a in i?i[a]:void 0;else throw Error(`NOT_FOUND`);return{val:e,obj:i,key:a}},u=e=>c(e.obj)&&typeof e.key==`number`,d=e=>e.obj.length===e.key,f=e=>typeof e.obj==`object`&&typeof e.key==`string`;Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return l}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/index.cjs
CHANGED
|
@@ -1,38 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _stormJson = require("./storm-json.cjs");
|
|
7
|
-
Object.keys(_stormJson).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _stormJson[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _stormJson[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _types = require("./types.cjs");
|
|
18
|
-
Object.keys(_types).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _types[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _types[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
var _utils = require("./utils/index.cjs");
|
|
29
|
-
Object.keys(_utils).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in exports && exports[key] === _utils[key]) return;
|
|
32
|
-
Object.defineProperty(exports, key, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () {
|
|
35
|
-
return _utils[key];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
1
|
+
const e=require(`./storm-json-DBxiMujR.cjs`),t=require(`./strip-comments-BhdK_E8s.cjs`),n=require(`./parse-DmriuGKI.cjs`),r=require(`./code-frames-DEWi5iIn.cjs`),i=require(`./parse-error-0BAtatMf.cjs`),a=require(`./stringify-Dp0lF-wN.cjs`);require(`./types.cjs`),require(`./utils-DFU9Wltn.cjs`),exports.StormJSON=e.t,exports.codeFrameColumns=r.t,exports.formatParseError=i.t,exports.invalidKeyChars=a.t,exports.parse=n.t,exports.safeParse=n.n,exports.stringify=a.n,exports.stripComments=t.t;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { C as TypedArrayAnnotation, S as TypeAnnotation, _ as PrimitiveTypeAnnotation, a as CustomTypeAnnotation, b as SymbolTypeAnnotation, c as JsonObject, d as JsonParserResult, f as JsonSerializeOptions, g as PrimitiveJsonValue, h as LeafTypeAnnotation, i as CompositeTypeAnnotation, l as JsonParseOptions, m as Leaf, n as ClassInstance, o as InnerNode, p as JsonValue, r as ClassTypeAnnotation, s as JsonArray, t as Class, u as JsonParserInterface, v as SerializableJsonValue, x as Tree, y as SimpleTypeAnnotation } from "./types-CEiKQHlk.cjs";
|
|
2
|
+
import { t as StormJSON } from "./storm-json-Q1bOIv3-.cjs";
|
|
3
|
+
import { t as codeFrameColumns } from "./code-frames-DViwqU8S.cjs";
|
|
4
|
+
import { n as parse, r as safeParse, t as Options } from "./parse-fX7NFKdt.cjs";
|
|
5
|
+
import { t as formatParseError } from "./parse-error-DLuqEXmf.cjs";
|
|
6
|
+
import { n as stringify, t as invalidKeyChars } from "./stringify-BpBMOhle.cjs";
|
|
7
|
+
import { t as stripComments } from "./strip-comments-CKLSXchM.cjs";
|
|
8
|
+
export { Class, ClassInstance, ClassTypeAnnotation, CompositeTypeAnnotation, CustomTypeAnnotation, InnerNode, JsonArray, JsonObject, JsonParseOptions, JsonParserInterface, JsonParserResult, JsonSerializeOptions, JsonValue, Leaf, LeafTypeAnnotation, Options, PrimitiveJsonValue, PrimitiveTypeAnnotation, SerializableJsonValue, SimpleTypeAnnotation, StormJSON, SymbolTypeAnnotation, Tree, TypeAnnotation, TypedArrayAnnotation, codeFrameColumns, formatParseError, invalidKeyChars, parse, safeParse, stringify, stripComments };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { C as TypedArrayAnnotation, S as TypeAnnotation, _ as PrimitiveTypeAnnotation, a as CustomTypeAnnotation, b as SymbolTypeAnnotation, c as JsonObject, d as JsonParserResult, f as JsonSerializeOptions, g as PrimitiveJsonValue, h as LeafTypeAnnotation, i as CompositeTypeAnnotation, l as JsonParseOptions, m as Leaf, n as ClassInstance, o as InnerNode, p as JsonValue, r as ClassTypeAnnotation, s as JsonArray, t as Class, u as JsonParserInterface, v as SerializableJsonValue, x as Tree, y as SimpleTypeAnnotation } from "./types-CQHq94S4.mjs";
|
|
2
|
+
import { t as StormJSON } from "./storm-json-CfqJ0KzG.mjs";
|
|
3
|
+
import { t as codeFrameColumns } from "./code-frames-CXX37tnR.mjs";
|
|
4
|
+
import { n as parse, r as safeParse, t as Options } from "./parse-xFkFesIF.mjs";
|
|
5
|
+
import { t as formatParseError } from "./parse-error-CJTV0jdn.mjs";
|
|
6
|
+
import { n as stringify, t as invalidKeyChars } from "./stringify-ln223ZC9.mjs";
|
|
7
|
+
import { t as stripComments } from "./strip-comments-DdsCzji6.mjs";
|
|
8
|
+
import "./index-CMuRFTR3.mjs";
|
|
9
|
+
export { Class, ClassInstance, ClassTypeAnnotation, CompositeTypeAnnotation, CustomTypeAnnotation, InnerNode, JsonArray, JsonObject, JsonParseOptions, JsonParserInterface, JsonParserResult, JsonSerializeOptions, JsonValue, Leaf, LeafTypeAnnotation, Options, PrimitiveJsonValue, PrimitiveTypeAnnotation, SerializableJsonValue, SimpleTypeAnnotation, StormJSON, SymbolTypeAnnotation, Tree, TypeAnnotation, TypedArrayAnnotation, codeFrameColumns, formatParseError, invalidKeyChars, parse, safeParse, stringify, stripComments };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{t as e}from"./strip-comments-LcqiBhvo.mjs";import{n as t,t as n}from"./parse-BpylFCf0.mjs";import{t as r}from"./code-frames-BQI7PKd_.mjs";import{t as i}from"./parse-error-DrJJkemH.mjs";import{n as a,t as o}from"./stringify-DjBDt8SC.mjs";import{t as s}from"./storm-json-BsdLpzM_.mjs";import"./types.mjs";import"./utils-BkLHzBxb.mjs";export{s as StormJSON,r as codeFrameColumns,i as formatParseError,o as invalidKeyChars,n as parse,t as safeParse,a as stringify,e as stripComments};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-number-CebQk_B0.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,EAAgB,GACvB,GAAS,KACJ,IAAU,IAAA,GAAY,qBAAuB,gBAE/C,OAAO,UAAU,SAAS,KAAK,EAAM,CCDjC,EAAY,GAAoC,CAC3D,GAAI,CACF,OACE,aAAiB,QACjB,OAAO,GAAU,UACjB,OAAO,EAAM,GAAK,OAEd,CACN,MAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=e=>e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e),t=e=>{try{return e instanceof Number||typeof e==`number`||Number(e)===e}catch{return!1}};Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return t}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./is-number-wfNPC3Mj.cjs`),t=e=>typeof e==`object`&&!!e,n=n=>{if(!t(n)||e.n(n)!==`[object Object]`)return!1;if(Object.getPrototypeOf(n)===null)return!0;let r=n;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(n)===r},r=e=>{try{return typeof e==`object`||!!e&&e?.constructor===Object||n(e)}catch{return!1}};Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return r}});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e}from"./is-number-CebQk_B0.mjs";const t=e=>typeof e==`object`&&!!e,n=n=>{if(!t(n)||e(n)!==`[object Object]`)return!1;if(Object.getPrototypeOf(n)===null)return!0;let r=n;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(n)===r},r=e=>{try{return typeof e==`object`||!!e&&e?.constructor===Object||n(e)}catch{return!1}};export{r as t};
|
|
2
|
+
//# sourceMappingURL=is-object-DDPbtSWR.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-object-DDPbtSWR.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":"6CA2CA,MAAa,EAAgB,GACpB,OAAO,GAAQ,YAAY,EA4BvB,EAAiB,GAAqC,CACjE,GAAI,CAAC,EAAa,EAAI,EAAI,EAAa,EAAI,GAAK,kBAC9C,MAAO,GAET,GAAI,OAAO,eAAe,EAAI,GAAK,KACjC,MAAO,GAET,IAAI,EAAQ,EACZ,KAAO,OAAO,eAAe,EAAM,GAAK,MACtC,EAAQ,OAAO,eAAe,EAAM,CAEtC,OAAO,OAAO,eAAe,EAAI,GAAK,GCV3B,EAAY,GAAoC,CAC3D,GAAI,CACF,OACE,OAAO,GAAU,UAChB,EAAQ,GAAU,GAAO,cAAgB,QAC1C,EAAc,EAAM,MAEhB,CACN,MAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=e=>{try{return typeof e==`string`}catch{return!1}};Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return e}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-string-VB7nGKjX.mjs","names":[],"sources":["../../type-checks/src/is-string.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const isString = (value: unknown): value is string => {\n try {\n return typeof value === \"string\";\n } catch {\n return false;\n }\n};\n"],"mappings":"AAkBA,MAAa,EAAY,GAAoC,CAC3D,GAAI,CACF,OAAO,OAAO,GAAU,cAClB,CACN,MAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-undefined-D6sfLkFq.mjs","names":[],"sources":["../../type-checks/src/is-undefined.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const isUndefined = (value: unknown): value is undefined => {\n return value === undefined;\n};\n"],"mappings":"AAkBA,MAAa,EAAe,GACnB,IAAU,IAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=e=>e===void 0;Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return e}});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as e}from"./is-number-CebQk_B0.mjs";import{t}from"./is-string-VB7nGKjX.mjs";const n=/~1/g,r=/~0/g,i=/~/g,a=/\//g;function o(e){return!e.includes(`/`)&&!e.includes(`~`)?e:e.replace(i,`~0`).replace(a,`~1`)}function s(e){return e.includes(`~`)?e.replace(n,`/`).replace(r,`~`):e}function c(e){return e?e.slice(1).split(`/`).map(e=>s(e)):[]}function l(e){return u(e)?``:`/${e.map(e=>o(String(e))).join(`/`)}`}const u=n=>t(n)?n===``:e(n)?n===0:Array.isArray(n)&&n.length===0;function d(e){if(e.length===0)throw Error(`NO_PARENT`);return e.slice(0,-1)}function f(t){if(e(t))return!0;let n=Number.parseInt(t,10);return String(n)===t&&n>=0}const p=e=>{let t=e.length,n=0,r;for(;n<t;){if(r=e.codePointAt(n),r>=48&&r<=57){n++;continue}return!1}return!0};export{f as a,s as c,u as i,l as n,d as o,p as r,c as s,o as t};
|
|
2
|
+
//# sourceMappingURL=parse-BYhuR8fo.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-BYhuR8fo.mjs","names":["charCode: any"],"sources":["../src/pointer/parse.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isNumber } from \"@stryke/type-checks/is-number\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport type { JsonPointerPath } from \"@stryke/types/json\";\n\nconst TILDE_ONE = /~1/g;\nconst TILDE_ZERO = /~0/g;\nconst TILDE = /~/g;\nconst FORWARD_SLASH = /\\//g;\n\n/**\n * Escapes a JSON pointer path segment.\n *\n * @param segment - JSON pointer path segment.\n * @returns Escaped JSON pointer path segment.\n */\nexport function escapePointerSegment(segment: string): string {\n if (!segment.includes(\"/\") && !segment.includes(\"~\")) {\n return segment;\n }\n\n return segment.replace(TILDE, \"~0\").replace(FORWARD_SLASH, \"~1\");\n}\n\n/**\n * Unescapes a JSON pointer path segment.\n *\n * @param segment - JSON pointer path segment.\n * @returns Unescaped JSON pointer path segment.\n */\nexport function unescapePointerSegment(segment: string): string {\n if (!segment.includes(\"~\")) {\n return segment;\n }\n\n return segment.replace(TILDE_ONE, \"/\").replace(TILDE_ZERO, \"~\");\n}\n\n/**\n * Convert JSON pointer like \"/foo/bar\" to array like [\"\", \"foo\", \"bar\"], while\n * also un-escaping reserved characters.\n */\nexport function parseJsonPointer(pointer: string): JsonPointerPath {\n if (!pointer) return [];\n // TODO: Performance of this line can be improved: (1) don't use .split(); (2) don't use .map().\n return pointer\n .slice(1)\n .split(\"/\")\n .map(segment => unescapePointerSegment(segment));\n}\n\n/**\n * Escape and format a path array like [\"\", \"foo\", \"bar\"] to JSON pointer\n * like \"/foo/bar\".\n */\nexport function formatJsonPointer(path: JsonPointerPath): string {\n // eslint-disable-next-line ts/no-use-before-define\n if (isRoot(path)) {\n return \"\";\n }\n\n return `/${path.map(segment => escapePointerSegment(String(segment))).join(\"/\")}`;\n}\n\n/**\n * Returns true if JSON Pointer points to root value, false otherwise.\n */\nexport const isRoot = (path: string | number | JsonPointerPath): boolean =>\n isString(path)\n ? path === \"\"\n : isNumber(path)\n ? path === 0\n : Array.isArray(path) && path.length === 0;\n\n/**\n * Returns parent path, e.g. for ['foo', 'bar', 'baz'] returns ['foo', 'bar'].\n */\nexport function parent(path: JsonPointerPath): JsonPointerPath {\n if (path.length === 0) {\n throw new Error(\"NO_PARENT\");\n }\n\n return path.slice(0, -1);\n}\n\n/**\n * Check if path component can be a valid array index.\n */\nexport function isValidIndex(index: string | number): boolean {\n if (isNumber(index)) {\n return true;\n }\n\n const n = Number.parseInt(index, 10);\n\n return String(n) === index && n >= 0;\n}\n\nexport const isInteger = (str: string): boolean => {\n const len = str.length;\n let i = 0;\n let charCode: any;\n while (i < len) {\n charCode = str.codePointAt(i);\n if (charCode >= 48 && charCode <= 57) {\n i++;\n continue;\n }\n return false;\n }\n return true;\n};\n"],"mappings":"qFAsBA,MAAM,EAAY,MACZ,EAAa,MACb,EAAQ,KACR,EAAgB,MAQtB,SAAgB,EAAqB,EAAyB,CAK5D,MAJI,CAAC,EAAQ,SAAS,IAAI,EAAI,CAAC,EAAQ,SAAS,IAAI,CAC3C,EAGF,EAAQ,QAAQ,EAAO,KAAK,CAAC,QAAQ,EAAe,KAAK,CASlE,SAAgB,EAAuB,EAAyB,CAK9D,OAJK,EAAQ,SAAS,IAAI,CAInB,EAAQ,QAAQ,EAAW,IAAI,CAAC,QAAQ,EAAY,IAAI,CAHtD,EAUX,SAAgB,EAAiB,EAAkC,CAGjE,OAFK,EAEE,EACJ,MAAM,EAAE,CACR,MAAM,IAAI,CACV,IAAI,GAAW,EAAuB,EAAQ,CAAC,CAL7B,EAAE,CAYzB,SAAgB,EAAkB,EAA+B,CAM/D,OAJI,EAAO,EAAK,CACP,GAGF,IAAI,EAAK,IAAI,GAAW,EAAqB,OAAO,EAAQ,CAAC,CAAC,CAAC,KAAK,IAAI,GAMjF,MAAa,EAAU,GACrB,EAAS,EAAK,CACV,IAAS,GACT,EAAS,EAAK,CACZ,IAAS,EACT,MAAM,QAAQ,EAAK,EAAI,EAAK,SAAW,EAK/C,SAAgB,EAAO,EAAwC,CAC7D,GAAI,EAAK,SAAW,EAClB,MAAU,MAAM,YAAY,CAG9B,OAAO,EAAK,MAAM,EAAG,GAAG,CAM1B,SAAgB,EAAa,EAAiC,CAC5D,GAAI,EAAS,EAAM,CACjB,MAAO,GAGT,IAAM,EAAI,OAAO,SAAS,EAAO,GAAG,CAEpC,OAAO,OAAO,EAAE,GAAK,GAAS,GAAK,EAGrC,MAAa,EAAa,GAAyB,CACjD,IAAM,EAAM,EAAI,OACZ,EAAI,EACJA,EACJ,KAAO,EAAI,GAAK,CAEd,GADA,EAAW,EAAI,YAAY,EAAE,CACzB,GAAY,IAAM,GAAY,GAAI,CACpC,IACA,SAEF,MAAO,GAET,MAAO"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as e}from"./strip-comments-LcqiBhvo.mjs";const t=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,n=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,r=/^\s*["[{]|^\s*-?\d{1,16}(?:\.\d{1,17})?(?:E[+-]?\d+)?\s*$/i;function i(e,t){if(e===`__proto__`||e===`constructor`&&t&&typeof t==`object`&&`prototype`in t){console.warn(`Dropping "${e}" key to prevent prototype pollution.`);return}return t}function a(a,o={}){if(typeof a!=`string`)return a;let s=e(a);if(s[0]===`"`&&s[s.length-1]===`"`&&!s.includes(`\\`))return s.slice(1,-1);if(s=s.trim(),s.length<=9)switch(s.toLowerCase()){case`true`:return!0;case`false`:return!1;case`undefined`:return;case`null`:return null;case`nan`:return NaN;case`infinity`:return 1/0;case`-infinity`:return-1/0}if(!r.test(s)){if(o.strict)throw Error(`Invalid JSON`);return s}try{if(t.test(s)||n.test(s)){if(o.strict)throw Error(`Possible prototype pollution`);return JSON.parse(s,i)}return JSON.parse(s)}catch(e){if(o.strict)throw e;return a}}function o(e,t={}){return a(e,{...t,strict:!0})}export{o as n,a as t};
|
|
2
|
+
//# sourceMappingURL=parse-BpylFCf0.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-BpylFCf0.mjs","names":[],"sources":["../src/utils/parse.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 { stripComments } from \"./strip-comments\";\n\n// https://github.com/fastify/secure-json-parse\n// https://github.com/hapijs/bourne\nconst suspectProtoRx =\n /\"(?:_|\\\\u0{2}5[Ff]){2}(?:p|\\\\u0{2}70)(?:r|\\\\u0{2}72)(?:o|\\\\u0{2}6[Ff])(?:t|\\\\u0{2}74)(?:o|\\\\u0{2}6[Ff])(?:_|\\\\u0{2}5[Ff]){2}\"\\s*:/;\nconst suspectConstructorRx =\n /\"(?:c|\\\\u0063)(?:o|\\\\u006[Ff])(?:n|\\\\u006[Ee])(?:s|\\\\u0073)(?:t|\\\\u0074)(?:r|\\\\u0072)(?:u|\\\\u0075)(?:c|\\\\u0063)(?:t|\\\\u0074)(?:o|\\\\u006[Ff])(?:r|\\\\u0072)\"\\s*:/;\n\nconst JsonSigRx = /^\\s*[\"[{]|^\\s*-?\\d{1,16}(?:\\.\\d{1,17})?(?:E[+-]?\\d+)?\\s*$/i;\n\nfunction jsonParseTransform(key: string, value: any): any {\n if (\n key === \"__proto__\" ||\n (key === \"constructor\" &&\n value &&\n typeof value === \"object\" &&\n \"prototype\" in value)\n ) {\n // eslint-disable-next-line no-console\n console.warn(`Dropping \"${key}\" key to prevent prototype pollution.`);\n return;\n }\n return value;\n}\n\nexport interface Options {\n strict?: boolean;\n}\n\nexport function parse<T = unknown>(value: any, options: Options = {}): T {\n if (typeof value !== \"string\") {\n return value;\n }\n\n let stripped = stripComments(value);\n\n if (\n stripped[0] === '\"' &&\n stripped[stripped.length - 1] === '\"' &&\n !stripped.includes(\"\\\\\")\n ) {\n return stripped.slice(1, -1) as T;\n }\n\n stripped = stripped.trim();\n\n if (stripped.length <= 9) {\n switch (stripped.toLowerCase()) {\n case \"true\": {\n return true as T;\n }\n case \"false\": {\n return false as T;\n }\n case \"undefined\": {\n return undefined as T;\n }\n case \"null\": {\n return null as T;\n }\n case \"nan\": {\n return Number.NaN as T;\n }\n case \"infinity\": {\n return Number.POSITIVE_INFINITY as T;\n }\n case \"-infinity\": {\n return Number.NEGATIVE_INFINITY as T;\n }\n }\n }\n\n if (!JsonSigRx.test(stripped)) {\n if (options.strict) {\n throw new Error(\"Invalid JSON\");\n }\n return stripped as T;\n }\n\n try {\n if (suspectProtoRx.test(stripped) || suspectConstructorRx.test(stripped)) {\n if (options.strict) {\n throw new Error(\"Possible prototype pollution\");\n }\n return JSON.parse(stripped, jsonParseTransform);\n }\n\n return JSON.parse(stripped);\n } catch (error) {\n if (options.strict) {\n throw error;\n }\n return value as T;\n }\n}\n\nexport function safeParse<T = unknown>(value: any, options: Options = {}): T {\n return parse<T>(value, { ...options, strict: true });\n}\n"],"mappings":"kDAsBA,MAAM,EACJ,oIACI,EACJ,iKAEI,EAAY,6DAElB,SAAS,EAAmB,EAAa,EAAiB,CACxD,GACE,IAAQ,aACP,IAAQ,eACP,GACA,OAAO,GAAU,UACjB,cAAe,EACjB,CAEA,QAAQ,KAAK,aAAa,EAAI,uCAAuC,CACrE,OAEF,OAAO,EAOT,SAAgB,EAAmB,EAAY,EAAmB,EAAE,CAAK,CACvE,GAAI,OAAO,GAAU,SACnB,OAAO,EAGT,IAAI,EAAW,EAAc,EAAM,CAEnC,GACE,EAAS,KAAO,KAChB,EAAS,EAAS,OAAS,KAAO,KAClC,CAAC,EAAS,SAAS,KAAK,CAExB,OAAO,EAAS,MAAM,EAAG,GAAG,CAK9B,GAFA,EAAW,EAAS,MAAM,CAEtB,EAAS,QAAU,EACrB,OAAQ,EAAS,aAAa,CAA9B,CACE,IAAK,OACH,MAAO,GAET,IAAK,QACH,MAAO,GAET,IAAK,YACH,OAEF,IAAK,OACH,OAAO,KAET,IAAK,MACH,MAAO,KAET,IAAK,WACH,MAAO,KAET,IAAK,YACH,MAAO,KAKb,GAAI,CAAC,EAAU,KAAK,EAAS,CAAE,CAC7B,GAAI,EAAQ,OACV,MAAU,MAAM,eAAe,CAEjC,OAAO,EAGT,GAAI,CACF,GAAI,EAAe,KAAK,EAAS,EAAI,EAAqB,KAAK,EAAS,CAAE,CACxE,GAAI,EAAQ,OACV,MAAU,MAAM,+BAA+B,CAEjD,OAAO,KAAK,MAAM,EAAU,EAAmB,CAGjD,OAAO,KAAK,MAAM,EAAS,OACpB,EAAO,CACd,GAAI,EAAQ,OACV,MAAM,EAER,OAAO,GAIX,SAAgB,EAAuB,EAAY,EAAmB,EAAE,CAAK,CAC3E,OAAO,EAAS,EAAO,CAAE,GAAG,EAAS,OAAQ,GAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./is-number-wfNPC3Mj.cjs`),t=require(`./is-string-D5yKZC0U.cjs`),n=/~1/g,r=/~0/g,i=/~/g,a=/\//g;function o(e){return!e.includes(`/`)&&!e.includes(`~`)?e:e.replace(i,`~0`).replace(a,`~1`)}function s(e){return e.includes(`~`)?e.replace(n,`/`).replace(r,`~`):e}function c(e){return e?e.slice(1).split(`/`).map(e=>s(e)):[]}function l(e){return u(e)?``:`/${e.map(e=>o(String(e))).join(`/`)}`}const u=n=>t.t(n)?n===``:e.t(n)?n===0:Array.isArray(n)&&n.length===0;function d(e){if(e.length===0)throw Error(`NO_PARENT`);return e.slice(0,-1)}function f(t){if(e.t(t))return!0;let n=Number.parseInt(t,10);return String(n)===t&&n>=0}const p=e=>{let t=e.length,n=0,r;for(;n<t;){if(r=e.codePointAt(n),r>=48&&r<=57){n++;continue}return!1}return!0};Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return o}});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//#region ../types/src/json.d.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Matches a JSON pointer's path segments.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* These segments are used to navigate through the JSON object structure and point to a specific, referenced value.
|
|
8
|
+
*/
|
|
9
|
+
type JsonPointerPath = (string | number)[];
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/pointer/parse.d.ts
|
|
12
|
+
/**
|
|
13
|
+
* Escapes a JSON pointer path segment.
|
|
14
|
+
*
|
|
15
|
+
* @param segment - JSON pointer path segment.
|
|
16
|
+
* @returns Escaped JSON pointer path segment.
|
|
17
|
+
*/
|
|
18
|
+
declare function escapePointerSegment(segment: string): string;
|
|
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
|
+
declare function unescapePointerSegment(segment: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Convert JSON pointer like "/foo/bar" to array like ["", "foo", "bar"], while
|
|
28
|
+
* also un-escaping reserved characters.
|
|
29
|
+
*/
|
|
30
|
+
declare function parseJsonPointer(pointer: string): JsonPointerPath;
|
|
31
|
+
/**
|
|
32
|
+
* Escape and format a path array like ["", "foo", "bar"] to JSON pointer
|
|
33
|
+
* like "/foo/bar".
|
|
34
|
+
*/
|
|
35
|
+
declare function formatJsonPointer(path: JsonPointerPath): string;
|
|
36
|
+
/**
|
|
37
|
+
* Returns true if JSON Pointer points to root value, false otherwise.
|
|
38
|
+
*/
|
|
39
|
+
declare const isRoot: (path: string | number | JsonPointerPath) => boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Returns parent path, e.g. for ['foo', 'bar', 'baz'] returns ['foo', 'bar'].
|
|
42
|
+
*/
|
|
43
|
+
declare function parent(path: JsonPointerPath): JsonPointerPath;
|
|
44
|
+
/**
|
|
45
|
+
* Check if path component can be a valid array index.
|
|
46
|
+
*/
|
|
47
|
+
declare function isValidIndex(index: string | number): boolean;
|
|
48
|
+
declare const isInteger: (str: string) => boolean;
|
|
49
|
+
//#endregion
|
|
50
|
+
export { isValidIndex as a, unescapePointerSegment as c, isRoot as i, formatJsonPointer as n, parent as o, isInteger as r, parseJsonPointer as s, escapePointerSegment as t };
|
|
51
|
+
//# sourceMappingURL=parse-D-7TqXVh.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-D-7TqXVh.d.mts","names":[],"sources":["../../types/src/json.ts","../src/pointer/parse.ts"],"sourcesContent":[],"mappings":";;;;;;;;KA6CY,eAAA;;;AAAZ;;;;ACZA;AAcA;AAYgB,iBA1BA,oBAAA,CA0BmC,OAAe,EAAA,MAAA,CAAA,EAAA,MAAA;AAalE;AAYA;AAUA;AAWA;AAUA;;iBApEgB,sBAAA;;;;;iBAYA,gBAAA,mBAAmC;;;;;iBAanC,iBAAA,OAAwB;;;;cAY3B,iCAAkC;;;;iBAU/B,MAAA,OAAa,kBAAkB;;;;iBAW/B,YAAA;cAUH"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//#region ../types/src/json.d.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Matches a JSON pointer's path segments.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* These segments are used to navigate through the JSON object structure and point to a specific, referenced value.
|
|
8
|
+
*/
|
|
9
|
+
type JsonPointerPath = (string | number)[];
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/pointer/parse.d.ts
|
|
12
|
+
/**
|
|
13
|
+
* Escapes a JSON pointer path segment.
|
|
14
|
+
*
|
|
15
|
+
* @param segment - JSON pointer path segment.
|
|
16
|
+
* @returns Escaped JSON pointer path segment.
|
|
17
|
+
*/
|
|
18
|
+
declare function escapePointerSegment(segment: string): string;
|
|
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
|
+
declare function unescapePointerSegment(segment: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Convert JSON pointer like "/foo/bar" to array like ["", "foo", "bar"], while
|
|
28
|
+
* also un-escaping reserved characters.
|
|
29
|
+
*/
|
|
30
|
+
declare function parseJsonPointer(pointer: string): JsonPointerPath;
|
|
31
|
+
/**
|
|
32
|
+
* Escape and format a path array like ["", "foo", "bar"] to JSON pointer
|
|
33
|
+
* like "/foo/bar".
|
|
34
|
+
*/
|
|
35
|
+
declare function formatJsonPointer(path: JsonPointerPath): string;
|
|
36
|
+
/**
|
|
37
|
+
* Returns true if JSON Pointer points to root value, false otherwise.
|
|
38
|
+
*/
|
|
39
|
+
declare const isRoot: (path: string | number | JsonPointerPath) => boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Returns parent path, e.g. for ['foo', 'bar', 'baz'] returns ['foo', 'bar'].
|
|
42
|
+
*/
|
|
43
|
+
declare function parent(path: JsonPointerPath): JsonPointerPath;
|
|
44
|
+
/**
|
|
45
|
+
* Check if path component can be a valid array index.
|
|
46
|
+
*/
|
|
47
|
+
declare function isValidIndex(index: string | number): boolean;
|
|
48
|
+
declare const isInteger: (str: string) => boolean;
|
|
49
|
+
//#endregion
|
|
50
|
+
export { isValidIndex as a, unescapePointerSegment as c, isRoot as i, formatJsonPointer as n, parent as o, isInteger as r, parseJsonPointer as s, escapePointerSegment as t };
|
|
51
|
+
//# sourceMappingURL=parse-DU-kIQN6.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-DU-kIQN6.d.cts","names":[],"sources":["../../types/src/json.ts","../src/pointer/parse.ts"],"sourcesContent":[],"mappings":";;;;;;;;KA6CY,eAAA;;;AAAZ;;;;ACZA;AAcA;AAYgB,iBA1BA,oBAAA,CA0BmC,OAAe,EAAA,MAAA,CAAA,EAAA,MAAA;AAalE;AAYA;AAUA;AAWA;AAUA;;iBApEgB,sBAAA;;;;;iBAYA,gBAAA,mBAAmC;;;;;iBAanC,iBAAA,OAAwB;;;;cAY3B,iCAAkC;;;;iBAU/B,MAAA,OAAa,kBAAkB;;;;iBAW/B,YAAA;cAUH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./strip-comments-BhdK_E8s.cjs`),t=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,n=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,r=/^\s*["[{]|^\s*-?\d{1,16}(?:\.\d{1,17})?(?:E[+-]?\d+)?\s*$/i;function i(e,t){if(e===`__proto__`||e===`constructor`&&t&&typeof t==`object`&&`prototype`in t){console.warn(`Dropping "${e}" key to prevent prototype pollution.`);return}return t}function a(a,o={}){if(typeof a!=`string`)return a;let s=e.t(a);if(s[0]===`"`&&s[s.length-1]===`"`&&!s.includes(`\\`))return s.slice(1,-1);if(s=s.trim(),s.length<=9)switch(s.toLowerCase()){case`true`:return!0;case`false`:return!1;case`undefined`:return;case`null`:return null;case`nan`:return NaN;case`infinity`:return 1/0;case`-infinity`:return-1/0}if(!r.test(s)){if(o.strict)throw Error(`Invalid JSON`);return s}try{if(t.test(s)||n.test(s)){if(o.strict)throw Error(`Possible prototype pollution`);return JSON.parse(s,i)}return JSON.parse(s)}catch(e){if(o.strict)throw e;return a}}function o(e,t={}){return a(e,{...t,strict:!0})}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return a}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./storm-json-DBxiMujR.cjs`),t=require(`./code-frames-DEWi5iIn.cjs`);let n=require(`jsonc-parser`),r=require(`lines-and-columns`);function i(e,i){let{error:a,offset:o,length:s}=i,c=new r.LinesAndColumns(e).locationForIndex(o),l=c?.line??0,u=c?.column??0;return l++,u++,`${(0,n.printParseErrorCode)(a)} in JSON at ${l}:${u}\n${t.t(e,{start:{line:l,column:u},end:{line:l,column:u+s}})}\n`}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return i}});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ParseError } from "jsonc-parser";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/parse-error.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Nicely formats a JSON error with context
|
|
7
|
+
*
|
|
8
|
+
* @param input - JSON content as string
|
|
9
|
+
* @param parseError - jsonc ParseError
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
declare function formatParseError(input: string, parseError: ParseError): string;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { formatParseError as t };
|
|
15
|
+
//# sourceMappingURL=parse-error-CJTV0jdn.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-error-CJTV0jdn.d.mts","names":[],"sources":["../src/utils/parse-error.ts"],"sourcesContent":[],"mappings":";;;;;;AA8BA;;;;;iBAAgB,gBAAA,4BAA4C"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ParseError } from "jsonc-parser";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/parse-error.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Nicely formats a JSON error with context
|
|
7
|
+
*
|
|
8
|
+
* @param input - JSON content as string
|
|
9
|
+
* @param parseError - jsonc ParseError
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
declare function formatParseError(input: string, parseError: ParseError): string;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { formatParseError as t };
|
|
15
|
+
//# sourceMappingURL=parse-error-DLuqEXmf.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-error-DLuqEXmf.d.cts","names":[],"sources":["../src/utils/parse-error.ts"],"sourcesContent":[],"mappings":";;;;;;AA8BA;;;;;iBAAgB,gBAAA,4BAA4C"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as e}from"./code-frames-BQI7PKd_.mjs";import{printParseErrorCode as t}from"jsonc-parser";import{LinesAndColumns as n}from"lines-and-columns";function r(r,i){let{error:a,offset:o,length:s}=i,c=new n(r).locationForIndex(o),l=c?.line??0,u=c?.column??0;return l++,u++,`${t(a)} in JSON at ${l}:${u}\n${e(r,{start:{line:l,column:u},end:{line:l,column:u+s}})}\n`}export{r as t};
|
|
2
|
+
//# sourceMappingURL=parse-error-DrJJkemH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-error-DrJJkemH.mjs","names":[],"sources":["../src/utils/parse-error.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ParseError } from \"jsonc-parser\";\nimport { printParseErrorCode } from \"jsonc-parser\";\nimport { LinesAndColumns } from \"lines-and-columns\";\nimport { codeFrameColumns } from \"./code-frames\";\n\n/**\n * Nicely formats a JSON error with context\n *\n * @param input - JSON content as string\n * @param parseError - jsonc ParseError\n * @returns\n */\nexport function formatParseError(input: string, parseError: ParseError) {\n const { error, offset, length } = parseError;\n const result = new LinesAndColumns(input).locationForIndex(offset);\n let line = result?.line ?? 0;\n let column = result?.column ?? 0;\n\n line++;\n column++;\n\n return `${printParseErrorCode(error)} in JSON at ${line}:${column}\\n${codeFrameColumns(\n input,\n {\n start: {\n line,\n column\n },\n end: {\n line,\n column: column + length\n }\n }\n )}\\n`;\n}\n"],"mappings":"sJA8BA,SAAgB,EAAiB,EAAe,EAAwB,CACtE,GAAM,CAAE,QAAO,SAAQ,UAAW,EAC5B,EAAS,IAAI,EAAgB,EAAM,CAAC,iBAAiB,EAAO,CAC9D,EAAO,GAAQ,MAAQ,EACvB,EAAS,GAAQ,QAAU,EAK/B,MAHA,KACA,IAEO,GAAG,EAAoB,EAAM,CAAC,cAAc,EAAK,GAAG,EAAO,IAAI,EACpE,EACA,CACE,MAAO,CACL,OACA,SACD,CACD,IAAK,CACH,OACA,OAAQ,EAAS,EAClB,CACF,CACF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/utils/parse.d.ts
|
|
2
|
+
interface Options {
|
|
3
|
+
strict?: boolean;
|
|
4
|
+
}
|
|
5
|
+
declare function parse<T = unknown>(value: any, options?: Options): T;
|
|
6
|
+
declare function safeParse<T = unknown>(value: any, options?: Options): T;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { parse as n, safeParse as r, Options as t };
|
|
9
|
+
//# sourceMappingURL=parse-fX7NFKdt.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-fX7NFKdt.d.cts","names":[],"sources":["../src/utils/parse.ts"],"sourcesContent":[],"mappings":";UA4CiB,OAAA;EAAA,MAAA,CAAA,EAAA,OAAO;AAIxB;AAmEgB,iBAnEA,KAmE4C,CAAA,IAAA,OAAgB,CAAA,CAAA,KAAA,EAAA,GAAA,EAAA,OAAA,CAAA,EAnEpB,OAmEoB,CAAA,EAnEL,CAmEK;iBAA5D,6CAA4C,UAAe"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/utils/parse.d.ts
|
|
2
|
+
interface Options {
|
|
3
|
+
strict?: boolean;
|
|
4
|
+
}
|
|
5
|
+
declare function parse<T = unknown>(value: any, options?: Options): T;
|
|
6
|
+
declare function safeParse<T = unknown>(value: any, options?: Options): T;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { parse as n, safeParse as r, Options as t };
|
|
9
|
+
//# sourceMappingURL=parse-xFkFesIF.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-xFkFesIF.d.mts","names":[],"sources":["../src/utils/parse.ts"],"sourcesContent":[],"mappings":";UA4CiB,OAAA;EAAA,MAAA,CAAA,EAAA,OAAO;AAIxB;AAmEgB,iBAnEA,KAmE4C,CAAA,IAAA,OAAgB,CAAA,CAAA,KAAA,EAAA,GAAA,EAAA,OAAA,CAAA,EAnEpB,OAmEoB,CAAA,EAnEL,CAmEK;iBAA5D,6CAA4C,UAAe"}
|
|
@@ -1,39 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isObjectReference = exports.isArrayReference = exports.isArrayEnd = exports.find = void 0;
|
|
7
|
-
var _isSetObject = require("@stryke/type-checks/is-set-object");
|
|
8
|
-
var _isString = require("@stryke/type-checks/is-string");
|
|
9
|
-
const {
|
|
10
|
-
isArray: i
|
|
11
|
-
} = Array;
|
|
12
|
-
const find = (e, t) => {
|
|
13
|
-
const f = t.length;
|
|
14
|
-
if (!f) return {
|
|
15
|
-
val: e
|
|
16
|
-
};
|
|
17
|
-
let r, n;
|
|
18
|
-
for (let o = 0; o < f; o++) if (r = e, n = t[o], i(r)) {
|
|
19
|
-
const y = r.length;
|
|
20
|
-
if (n === "-") n = y;else if ((0, _isString.isString)(n)) {
|
|
21
|
-
const c = Math.trunc(Number.parseInt(n));
|
|
22
|
-
if (String(c) !== n) throw new Error("INVALID_INDEX");
|
|
23
|
-
if (n = c, n < 0) throw new Error("INVALID_INDEX");
|
|
24
|
-
}
|
|
25
|
-
n && (e = r[n]);
|
|
26
|
-
} else if ((0, _isSetObject.isSetObject)(r)) e = n && n in r ? r[n] : void 0;else throw new Error("NOT_FOUND");
|
|
27
|
-
return {
|
|
28
|
-
val: e,
|
|
29
|
-
obj: r,
|
|
30
|
-
key: n
|
|
31
|
-
};
|
|
32
|
-
},
|
|
33
|
-
isArrayReference = e => i(e.obj) && typeof e.key == "number",
|
|
34
|
-
isArrayEnd = e => e.obj.length === e.key,
|
|
35
|
-
isObjectReference = e => typeof e.obj == "object" && typeof e.key == "string";
|
|
36
|
-
exports.isObjectReference = isObjectReference;
|
|
37
|
-
exports.isArrayEnd = isArrayEnd;
|
|
38
|
-
exports.isArrayReference = isArrayReference;
|
|
39
|
-
exports.find = find;
|
|
1
|
+
const e=require(`../find-reference-DQJK1LbJ.cjs`);exports.find=e.t,exports.isArrayEnd=e.n,exports.isArrayReference=e.r,exports.isObjectReference=e.i;
|
|
@@ -0,0 +1,2 @@
|
|
|
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-ChoPoDcB.cjs";
|
|
2
|
+
export { ArrayReference, ObjectReference, Reference, find, isArrayEnd, isArrayReference, isObjectReference };
|
|
@@ -0,0 +1,2 @@
|
|
|
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-AvNORSzC.mjs";
|
|
2
|
+
export { ArrayReference, ObjectReference, Reference, find, isArrayEnd, isArrayReference, isObjectReference };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{i as e,n as t,r as n,t as r}from"../find-reference-BUIYIOS4.mjs";export{r as find,t as isArrayEnd,n as isArrayReference,e as isObjectReference};
|
package/dist/pointer/index.cjs
CHANGED
|
@@ -1,27 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _findReference = require("./find-reference.cjs");
|
|
7
|
-
Object.keys(_findReference).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _findReference[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _findReference[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _parse = require("./parse.cjs");
|
|
18
|
-
Object.keys(_parse).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _parse[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _parse[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
1
|
+
const e=require(`../find-reference-DQJK1LbJ.cjs`),t=require(`../parse-BwhwGAkA.cjs`);exports.escapePointerSegment=t.t,exports.find=e.t,exports.formatJsonPointer=t.n,exports.isArrayEnd=e.n,exports.isArrayReference=e.r,exports.isInteger=t.r,exports.isObjectReference=e.i,exports.isRoot=t.i,exports.isValidIndex=t.a,exports.parent=t.o,exports.parseJsonPointer=t.s,exports.unescapePointerSegment=t.c;
|
|
@@ -0,0 +1,3 @@
|
|
|
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-ChoPoDcB.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-DU-kIQN6.cjs";
|
|
3
|
+
export { ArrayReference, ObjectReference, Reference, escapePointerSegment, find, formatJsonPointer, isArrayEnd, isArrayReference, isInteger, isObjectReference, isRoot, isValidIndex, parent, parseJsonPointer, unescapePointerSegment };
|
|
@@ -0,0 +1,3 @@
|
|
|
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-AvNORSzC.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-D-7TqXVh.mjs";
|
|
3
|
+
export { ArrayReference, ObjectReference, Reference, escapePointerSegment, find, formatJsonPointer, isArrayEnd, isArrayReference, isInteger, isObjectReference, isRoot, isValidIndex, parent, parseJsonPointer, unescapePointerSegment };
|
package/dist/pointer/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{i as e,n as t,r as n,t as r}from"../find-reference-BUIYIOS4.mjs";import{a as i,c as a,i as o,n as s,o as c,r as l,s as u,t as d}from"../parse-BYhuR8fo.mjs";export{d as escapePointerSegment,r as find,s as formatJsonPointer,t as isArrayEnd,n as isArrayReference,l as isInteger,e as isObjectReference,o as isRoot,i as isValidIndex,c as parent,u as parseJsonPointer,a as unescapePointerSegment};
|