@stryke/json 0.9.2 → 0.9.3
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.
|
@@ -18,12 +18,12 @@ const find = (e, t) => {
|
|
|
18
18
|
for (let o = 0; o < f; o++) if (r = e, n = t[o], i(r)) {
|
|
19
19
|
const y = r.length;
|
|
20
20
|
if (n === "-") n = y;else if ((0, _isString.isString)(n)) {
|
|
21
|
-
const c = Math.trunc(n);
|
|
21
|
+
const c = Math.trunc(Number.parseInt(n));
|
|
22
22
|
if (String(c) !== n) throw new Error("INVALID_INDEX");
|
|
23
23
|
if (n = c, n < 0) throw new Error("INVALID_INDEX");
|
|
24
24
|
}
|
|
25
25
|
n && (e = r[n]);
|
|
26
|
-
} else if ((0, _isSetObject.isSetObject)(r)) e = n in r ? r[n] : void 0;else throw new Error("NOT_FOUND");
|
|
26
|
+
} else if ((0, _isSetObject.isSetObject)(r)) e = n && n in r ? r[n] : void 0;else throw new Error("NOT_FOUND");
|
|
27
27
|
return {
|
|
28
28
|
val: e,
|
|
29
29
|
obj: r,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isSetObject as s}from"@stryke/type-checks/is-set-object";import{isString as a}from"@stryke/type-checks/is-string";const{isArray:i}=Array;export const find=(e,t)=>{const f=t.length;if(!f)return{val:e};let r,n;for(let o=0;o<f;o++)if(r=e,n=t[o],i(r)){const y=r.length;if(n==="-")n=y;else if(a(n)){const c=Math.trunc(n);if(String(c)!==n)throw new Error("INVALID_INDEX");if(n=c,n<0)throw new Error("INVALID_INDEX")}n&&(e=r[n])}else if(s(r))e=n in r?r[n]:void 0;else throw new Error("NOT_FOUND");return{val:e,obj:r,key:n}},isArrayReference=e=>i(e.obj)&&typeof e.key=="number",isArrayEnd=e=>e.obj.length===e.key,isObjectReference=e=>typeof e.obj=="object"&&typeof e.key=="string";
|
|
1
|
+
import{isSetObject as s}from"@stryke/type-checks/is-set-object";import{isString as a}from"@stryke/type-checks/is-string";const{isArray:i}=Array;export const find=(e,t)=>{const f=t.length;if(!f)return{val:e};let r,n;for(let o=0;o<f;o++)if(r=e,n=t[o],i(r)){const y=r.length;if(n==="-")n=y;else if(a(n)){const c=Math.trunc(Number.parseInt(n));if(String(c)!==n)throw new Error("INVALID_INDEX");if(n=c,n<0)throw new Error("INVALID_INDEX")}n&&(e=r[n])}else if(s(r))e=n&&n in r?r[n]:void 0;else throw new Error("NOT_FOUND");return{val:e,obj:r,key:n}},isArrayReference=e=>i(e.obj)&&typeof e.key=="number",isArrayEnd=e=>e.obj.length===e.key,isObjectReference=e=>typeof e.obj=="object"&&typeof e.key=="string";
|
package/dist/types.d.ts
CHANGED
|
@@ -55,7 +55,7 @@ export interface JsonParserResult {
|
|
|
55
55
|
referentialEqualities?: Record<string, string[]> | [string[]] | [string[], Record<string, string[]>];
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
export interface
|
|
58
|
+
export interface JsonParserInterface {
|
|
59
59
|
parse: <TData = any>(strData: string) => TData;
|
|
60
60
|
stringify: <TData = any>(data: TData) => string;
|
|
61
61
|
serialize: (object: JsonValue) => JsonParserResult;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stryke/json",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing JSON parsing/stringify utilities used by Storm Software.",
|
|
6
6
|
"repository": {
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"buffer": "6.0.3",
|
|
14
14
|
"lines-and-columns": "2.0.4",
|
|
15
15
|
"superjson": "2.2.2",
|
|
16
|
-
"@stryke/type-checks": "^0.3.
|
|
17
|
-
"@stryke/types": "^0.8.
|
|
16
|
+
"@stryke/type-checks": "^0.3.6",
|
|
17
|
+
"@stryke/types": "^0.8.6"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": { "@types/node": "^22.14.0" },
|
|
20
20
|
"publishConfig": { "access": "public" },
|
|
@@ -257,5 +257,6 @@
|
|
|
257
257
|
},
|
|
258
258
|
"main": "./dist/index.cjs",
|
|
259
259
|
"module": "./dist/index.mjs",
|
|
260
|
-
"types": "./dist/index.d.ts"
|
|
260
|
+
"types": "./dist/index.d.ts",
|
|
261
|
+
"gitHead": "57da58e3434302b35f798674d9f18f92ca7f7ac9"
|
|
261
262
|
}
|