@stryke/json 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/{code-frames-BMkA9i6j.d.mts → code-frames-CrTAYYSE.d.mts} +1 -1
- package/dist/{code-frames-BMkA9i6j.d.mts.map → code-frames-CrTAYYSE.d.mts.map} +1 -1
- package/dist/{code-frames-DISWdYL6.mjs → code-frames-DuBfTMu4.mjs} +1 -1
- package/dist/{code-frames-DISWdYL6.mjs.map → code-frames-DuBfTMu4.mjs.map} +1 -1
- package/dist/{find-reference-b7rRdLFx.d.mts → find-reference-B8xshNXL.d.mts} +1 -1
- package/dist/{find-reference-b7rRdLFx.d.mts.map → find-reference-B8xshNXL.d.mts.map} +1 -1
- package/dist/{find-reference-woYMiWzN.mjs → find-reference-DMSYEaaI.mjs} +2 -73
- package/dist/find-reference-DMSYEaaI.mjs.map +1 -0
- package/dist/{find-reference-BCg3dQx1.cjs → find-reference-De5vBQV2.cjs} +2 -73
- package/dist/index.cjs +16 -11
- package/dist/index.d.cts +4 -4
- package/dist/index.d.mts +12 -12
- package/dist/index.mjs +12 -12
- package/dist/is-set-object-BmHip9em.cjs +108 -0
- package/dist/is-set-object-C1Qnj1Q8.mjs +98 -0
- package/dist/is-set-object-C1Qnj1Q8.mjs.map +1 -0
- package/dist/{parse-wxSDzBPf.cjs → parse-ByDxRup5.cjs} +1 -1
- package/dist/{parse-ZRTh45ZI.d.mts → parse-Cj-YfhrI.d.mts} +1 -1
- package/dist/{parse-ZRTh45ZI.d.mts.map → parse-Cj-YfhrI.d.mts.map} +1 -1
- package/dist/{parse-obdkJfj5.mjs → parse-Dn43ZK9y.mjs} +2 -2
- package/dist/{parse-obdkJfj5.mjs.map → parse-Dn43ZK9y.mjs.map} +1 -1
- package/dist/{parse-error-C3Qmubee.mjs → parse-error-Af4zHUQ_.mjs} +2 -2
- package/dist/{parse-error-C3Qmubee.mjs.map → parse-error-Af4zHUQ_.mjs.map} +1 -1
- package/dist/{parse-error-DY_MelEh.d.mts → parse-error-DpEv3vo_.d.mts} +1 -1
- package/dist/parse-error-DpEv3vo_.d.mts.map +1 -0
- package/dist/{parse-error-Dzwg4sdE.cjs → parse-error-N7UE-HMh.cjs} +2 -2
- package/dist/{parse-DgYW5BBj.d.mts → parse-fXy5pbmE.d.mts} +1 -1
- package/dist/{parse-DgYW5BBj.d.mts.map → parse-fXy5pbmE.d.mts.map} +1 -1
- package/dist/{parse-Crgv3Nl1.mjs → parse-vw_qRD3F.mjs} +1 -1
- package/dist/{parse-Crgv3Nl1.mjs.map → parse-vw_qRD3F.mjs.map} +1 -1
- package/dist/pointer/find-reference.cjs +1 -1
- package/dist/pointer/find-reference.d.mts +1 -1
- package/dist/pointer/find-reference.mjs +1 -1
- package/dist/pointer/index.cjs +3 -3
- package/dist/pointer/index.d.mts +2 -2
- package/dist/pointer/index.mjs +3 -3
- package/dist/pointer/parse.cjs +1 -1
- package/dist/pointer/parse.d.mts +1 -1
- package/dist/pointer/parse.mjs +1 -1
- package/dist/schema-BO1HCrxv.d.cts +55 -0
- package/dist/schema-BO1HCrxv.d.cts.map +1 -0
- package/dist/schema-CmH1V_uI.d.mts +55 -0
- package/dist/schema-CmH1V_uI.d.mts.map +1 -0
- package/dist/schema-DGmzxHja.mjs +72 -0
- package/dist/schema-DGmzxHja.mjs.map +1 -0
- package/dist/schema-Dl018Aq4.cjs +106 -0
- package/dist/schema.cjs +7 -2
- package/dist/schema.d.cts +2 -2
- package/dist/schema.d.mts +3 -3
- package/dist/schema.mjs +2 -2
- package/dist/{storm-json-AaFeOao2.d.cts → storm-json-8F9CKpXu.d.mts} +2 -2
- package/dist/{storm-json-AaFeOao2.d.cts.map → storm-json-8F9CKpXu.d.mts.map} +1 -1
- package/dist/{storm-json-6WpS7qnH.cjs → storm-json-BD6WFbrI.cjs} +3 -3
- package/dist/{storm-json-BvRkzAlR.d.mts → storm-json-DvIEWMEH.d.cts} +2 -2
- package/dist/{storm-json-BvRkzAlR.d.mts.map → storm-json-DvIEWMEH.d.cts.map} +1 -1
- package/dist/{storm-json-Cy3PuAhj.mjs → storm-json-nkhJgTz4.mjs} +4 -4
- package/dist/{storm-json-Cy3PuAhj.mjs.map → storm-json-nkhJgTz4.mjs.map} +1 -1
- package/dist/storm-json.cjs +2 -2
- package/dist/storm-json.d.cts +1 -1
- package/dist/storm-json.d.mts +2 -2
- package/dist/storm-json.mjs +2 -2
- package/dist/{stringify-B6iAeg0u.d.mts → stringify-CFT1K1LE.d.mts} +1 -1
- package/dist/stringify-CFT1K1LE.d.mts.map +1 -0
- package/dist/{stringify-D5baUfEe.mjs → stringify-CYHjAvWm.mjs} +1 -1
- package/dist/{stringify-D5baUfEe.mjs.map → stringify-CYHjAvWm.mjs.map} +1 -1
- package/dist/{strip-comments-Bg3R_Y4S.d.mts → strip-comments-BA8MS_Fs.d.mts} +1 -1
- package/dist/{strip-comments-Bg3R_Y4S.d.mts.map → strip-comments-BA8MS_Fs.d.mts.map} +1 -1
- package/dist/{strip-comments-CMaAgTqz.mjs → strip-comments-Dq00N_Sg.mjs} +1 -1
- package/dist/{strip-comments-CMaAgTqz.mjs.map → strip-comments-Dq00N_Sg.mjs.map} +1 -1
- package/dist/{types-C_KlcCNw.d.mts → types-Bn8rC098.d.cts} +5 -5
- package/dist/{types-BUeTTE_U.d.cts.map → types-Bn8rC098.d.cts.map} +1 -1
- package/dist/{types-BUeTTE_U.d.cts → types-CPQlxauZ.d.mts} +5 -5
- package/dist/{types-C_KlcCNw.d.mts.map → types-CPQlxauZ.d.mts.map} +1 -1
- package/dist/types.d.cts +2 -2
- package/dist/types.d.mts +2 -2
- package/dist/utils/code-frames.cjs +1 -1
- package/dist/utils/code-frames.d.mts +1 -1
- package/dist/utils/code-frames.mjs +1 -1
- package/dist/utils/index.cjs +6 -6
- package/dist/utils/index.d.mts +6 -6
- package/dist/utils/index.mjs +6 -6
- package/dist/utils/parse-error.cjs +1 -1
- package/dist/utils/parse-error.d.mts +1 -1
- package/dist/utils/parse-error.mjs +1 -1
- package/dist/utils/parse.cjs +1 -1
- package/dist/utils/parse.d.mts +1 -1
- package/dist/utils/parse.mjs +1 -1
- package/dist/utils/stringify.cjs +1 -1
- package/dist/utils/stringify.d.mts +1 -1
- package/dist/utils/stringify.mjs +1 -1
- package/dist/utils/strip-comments.cjs +1 -1
- package/dist/utils/strip-comments.d.mts +1 -1
- package/dist/utils/strip-comments.mjs +1 -1
- package/package.json +7 -3
- package/dist/find-reference-woYMiWzN.mjs.map +0 -1
- package/dist/parse-error-DY_MelEh.d.mts.map +0 -1
- package/dist/schema-B1RVJHzJ.d.cts +0 -7
- package/dist/schema-B1RVJHzJ.d.cts.map +0 -1
- package/dist/schema-CfhPLy30.mjs +0 -9
- package/dist/schema-CfhPLy30.mjs.map +0 -1
- package/dist/schema-D5Aqvh2i.cjs +0 -14
- package/dist/schema-ai_NU-JC.d.mts +0 -7
- package/dist/schema-ai_NU-JC.d.mts.map +0 -1
- package/dist/stringify-B6iAeg0u.d.mts.map +0 -1
- /package/dist/{code-frames-Cv8r5tSN.cjs → code-frames-BmUvlJ0w.cjs} +0 -0
- /package/dist/{index-DwO9IdNa.d.mts → index-CCt0lwyI.d.mts} +0 -0
- /package/dist/{index-VWno75SQ.d.mts → index-DvuJXuAN.d.mts} +0 -0
- /package/dist/{parse-KiRakdIR.cjs → parse-Bp6kkcQ4.cjs} +0 -0
- /package/dist/{pointer-Cc7IR0Bj.cjs → pointer-B3W_Sme3.cjs} +0 -0
- /package/dist/{pointer-CiTXvh1G.mjs → pointer-Dn__XOdY.mjs} +0 -0
- /package/dist/{stringify-DEw3S4_Z.cjs → stringify-BehjrfhS.cjs} +0 -0
- /package/dist/{strip-comments-CtFoX0xG.cjs → strip-comments-CmEG_smS.cjs} +0 -0
- /package/dist/{utils-CVcIdLuL.mjs → utils-jN2UkvqB.cjs} +0 -0
- /package/dist/{utils-Cz3OCwUK.cjs → utils-mEkKIcgl.mjs} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog for Stryke - JSON
|
|
4
4
|
|
|
5
|
+
## [0.10.0](https://github.com/storm-software/stryke/releases/tag/json%400.10.0) (03/02/2026)
|
|
6
|
+
|
|
7
|
+
### Miscellaneous
|
|
8
|
+
|
|
9
|
+
- **json:** Added `$defs` to JSON schema meta definition ([7808fbd0](https://github.com/storm-software/stryke/commit/7808fbd0))
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
- **json:** Added `JsonSchema7` type defintions and helpers ([677e7c39](https://github.com/storm-software/stryke/commit/677e7c39))
|
|
14
|
+
|
|
15
|
+
### Updated Dependencies
|
|
16
|
+
|
|
17
|
+
- Updated **type-checks** to **v0.5.27**
|
|
18
|
+
- Updated **types** to **v0.10.41**
|
|
19
|
+
|
|
5
20
|
## [0.9.44](https://github.com/storm-software/stryke/releases/tag/json%400.9.44) (03/02/2026)
|
|
6
21
|
|
|
7
22
|
### Updated Dependencies
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-frames-
|
|
1
|
+
{"version":3,"file":"code-frames-CrTAYYSE.d.mts","names":[],"sources":["../src/utils/code-frames.ts"],"sourcesContent":[],"mappings":";UAkBU,QAAA;EAAA,MAAA,EAAA,MAAQ;EAKR,IAAA,EAAA,MAAA;AAoFV;UApFU,YAAA;QACF;UACE;;iBAkFM,gBAAA,wBAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-frames-
|
|
1
|
+
{"version":3,"file":"code-frames-DuBfTMu4.mjs","names":["startLoc: Location","endLoc: Location"],"sources":["../src/utils/code-frames.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\ninterface Location {\n column: number;\n line: number;\n}\n\ninterface NodeLocation {\n end?: Location;\n start?: Location;\n}\n\n// Adapted from https://raw.githubusercontent.com/babel/babel/4108524/packages/babel-code-frame/src/index.js\n\n/**\n * RegExp to test for newlines in terminal.\n */\nconst NEWLINE = /\\r\\n|[\\n\\r\\u2028\\u2029]/;\n\n/**\n * Extract what lines should be marked and highlighted.\n */\nfunction getMarkerLines(\n loc: NodeLocation,\n source: string[],\n opts: { linesAbove?: number; linesBelow?: number } = {}\n): {\n start: number;\n end: number;\n markerLines: Record<number, boolean | [number, number]>;\n} {\n const startLoc: Location = {\n column: 0,\n line: -1,\n ...loc.start\n };\n const endLoc: Location = {\n ...startLoc,\n ...loc.end\n };\n const { linesAbove = 2, linesBelow = 3 } = opts || {};\n const startLine = startLoc.line;\n const startColumn = startLoc.column;\n const endLine = endLoc.line;\n const endColumn = endLoc.column;\n\n let start = Math.max(startLine - (linesAbove + 1), 0);\n let end = Math.min(source.length, endLine + linesBelow);\n\n if (startLine === -1) {\n start = 0;\n }\n\n if (endLine === -1) {\n end = source.length;\n }\n\n const lineDiff = endLine - startLine;\n const markerLines = {} as Record<number, boolean | [number, number]>;\n\n if (lineDiff) {\n for (let i = 0; i <= lineDiff; i++) {\n const lineNumber = i + startLine;\n\n if (!startColumn) {\n markerLines[lineNumber] = true;\n } else if (i === 0) {\n const sourceLength = source[lineNumber - 1]?.length ?? 0;\n\n markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];\n } else if (i === lineDiff) {\n markerLines[lineNumber] = [0, endColumn];\n } else {\n const sourceLength = source[lineNumber - i]?.length ?? 0;\n\n markerLines[lineNumber] = [0, sourceLength];\n }\n }\n } else if (startColumn === endColumn) {\n markerLines[startLine] = startColumn ? [startColumn, 0] : true;\n } else {\n markerLines[startLine] = [startColumn, endColumn - startColumn];\n }\n\n return {\n start,\n end,\n markerLines\n };\n}\n\nexport function codeFrameColumns(\n rawLines: string,\n loc: NodeLocation,\n opts: {\n linesAbove?: number;\n linesBelow?: number;\n highlight?: (rawLines: string) => string;\n } = {}\n): string {\n const lines = rawLines.split(NEWLINE);\n const { start, end, markerLines } = getMarkerLines(loc, lines, opts);\n\n const numberMaxWidth = String(end).length;\n const highlightedLines = opts.highlight ? opts.highlight(rawLines) : rawLines;\n\n const frame = highlightedLines\n .split(NEWLINE)\n .slice(start, end)\n .map((line, index) => {\n const number = start + 1 + index;\n const paddedNumber = ` ${number}`.slice(-numberMaxWidth);\n const gutter = ` ${paddedNumber} | `;\n const hasMarker = Boolean(markerLines[number] ?? false);\n if (hasMarker) {\n let markerLine = \"\";\n if (Array.isArray(hasMarker)) {\n const markerSpacing = line\n .slice(0, Math.max(hasMarker[0] - 1, 0))\n .replace(/[^\\t]/g, \" \");\n const numberOfMarkers = hasMarker[1] || 1;\n\n markerLine = [\n \"\\n \",\n gutter.replace(/\\d/g, \" \"),\n markerSpacing,\n \"^\".repeat(numberOfMarkers)\n ].join(\"\");\n }\n return [\">\", gutter, line, markerLine].join(\"\");\n }\n return ` ${gutter}${line}`;\n })\n .join(\"\\n\");\n\n return frame;\n}\n"],"mappings":";;;;AAiCA,MAAM,UAAU;;;;AAKhB,SAAS,eACP,KACA,QACA,OAAqD,EAAE,EAKvD;CACA,MAAMA,WAAqB;EACzB,QAAQ;EACR,MAAM;EACN,GAAG,IAAI;EACR;CACD,MAAMC,SAAmB;EACvB,GAAG;EACH,GAAG,IAAI;EACR;CACD,MAAM,EAAE,aAAa,GAAG,aAAa,MAAM,QAAQ,EAAE;CACrD,MAAM,YAAY,SAAS;CAC3B,MAAM,cAAc,SAAS;CAC7B,MAAM,UAAU,OAAO;CACvB,MAAM,YAAY,OAAO;CAEzB,IAAI,QAAQ,KAAK,IAAI,aAAa,aAAa,IAAI,EAAE;CACrD,IAAI,MAAM,KAAK,IAAI,OAAO,QAAQ,UAAU,WAAW;AAEvD,KAAI,cAAc,GAChB,SAAQ;AAGV,KAAI,YAAY,GACd,OAAM,OAAO;CAGf,MAAM,WAAW,UAAU;CAC3B,MAAM,cAAc,EAAE;AAEtB,KAAI,SACF,MAAK,IAAI,IAAI,GAAG,KAAK,UAAU,KAAK;EAClC,MAAM,aAAa,IAAI;AAEvB,MAAI,CAAC,YACH,aAAY,cAAc;WACjB,MAAM,EAGf,aAAY,cAAc,CAAC,cAFN,OAAO,aAAa,IAAI,UAAU,KAEA,cAAc,EAAE;WAC9D,MAAM,SACf,aAAY,cAAc,CAAC,GAAG,UAAU;MAIxC,aAAY,cAAc,CAAC,GAFN,OAAO,aAAa,IAAI,UAAU,EAEZ;;UAGtC,gBAAgB,UACzB,aAAY,aAAa,cAAc,CAAC,aAAa,EAAE,GAAG;KAE1D,aAAY,aAAa,CAAC,aAAa,YAAY,YAAY;AAGjE,QAAO;EACL;EACA;EACA;EACD;;AAGH,SAAgB,iBACd,UACA,KACA,OAII,EAAE,EACE;CAER,MAAM,EAAE,OAAO,KAAK,gBAAgB,eAAe,KADrC,SAAS,MAAM,QAAQ,EAC0B,KAAK;CAEpE,MAAM,iBAAiB,OAAO,IAAI,CAAC;AAgCnC,SA/ByB,KAAK,YAAY,KAAK,UAAU,SAAS,GAAG,UAGlE,MAAM,QAAQ,CACd,MAAM,OAAO,IAAI,CACjB,KAAK,MAAM,UAAU;EACpB,MAAM,SAAS,QAAQ,IAAI;EAE3B,MAAM,SAAS,IADM,IAAI,SAAS,MAAM,CAAC,eAAe,CACxB;EAChC,MAAM,YAAY,QAAQ,YAAY,WAAW,MAAM;AACvD,MAAI,WAAW;GACb,IAAI,aAAa;AACjB,OAAI,MAAM,QAAQ,UAAU,EAAE;IAC5B,MAAM,gBAAgB,KACnB,MAAM,GAAG,KAAK,IAAI,UAAU,KAAK,GAAG,EAAE,CAAC,CACvC,QAAQ,UAAU,IAAI;IACzB,MAAM,kBAAkB,UAAU,MAAM;AAExC,iBAAa;KACX;KACA,OAAO,QAAQ,OAAO,IAAI;KAC1B;KACA,IAAI,OAAO,gBAAgB;KAC5B,CAAC,KAAK,GAAG;;AAEZ,UAAO;IAAC;IAAK;IAAQ;IAAM;IAAW,CAAC,KAAK,GAAG;;AAEjD,SAAO,IAAI,SAAS;GACpB,CACD,KAAK,KAAK"}
|
|
@@ -49,4 +49,4 @@ interface ObjectReference<T = unknown> {
|
|
|
49
49
|
declare const isObjectReference: <T = unknown>(ref: Reference) => ref is ObjectReference<T>;
|
|
50
50
|
//#endregion
|
|
51
51
|
export { isArrayEnd as a, find as i, ObjectReference as n, isArrayReference as o, Reference as r, isObjectReference as s, ArrayReference as t };
|
|
52
|
-
//# sourceMappingURL=find-reference-
|
|
52
|
+
//# sourceMappingURL=find-reference-B8xshNXL.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-reference-
|
|
1
|
+
{"version":3,"file":"find-reference-B8xshNXL.d.mts","names":[],"sources":["../src/pointer/find-reference.ts"],"sourcesContent":[],"mappings":";UAqBiB,SAAA;EAAA;EAoCJ,SAyCZ,GAAA,EAAA,OAzCwC;EA2CxB;EAOJ,SAAA,GAAA,CAAA,EAAA,OAEiE,GAAA,MAAA,GAAA,OAAA,EAAA;EADvE;EACkB,SAAA,GAAA,CAAA,EAAA,MAAA,GAAA,MAAA;;;AAEzB;AAGA;;;;;AAMA;;;;;;;;;;;;;;;;;;cA/Da,2BAA4B,uBAAqB;UA2C7C;;4BAEW;gBACZ;;;cAIH,qCACN,qBACG,eAAe;cAEZ,kBAAmB;UAGf;gBACD;gBACA,eAAe;;;cAIlB,sCACN,qBACG,gBAAgB"}
|
|
@@ -1,77 +1,6 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { t as isUndefined } from "./is-undefined-CmyJWYGD.mjs";
|
|
1
|
+
import { t as isSetObject } from "./is-set-object-C1Qnj1Q8.mjs";
|
|
3
2
|
import { t as isString } from "./is-string-CLiBUSKV.mjs";
|
|
4
3
|
|
|
5
|
-
//#region ../type-checks/src/is-null.ts
|
|
6
|
-
const isNull = (value) => {
|
|
7
|
-
try {
|
|
8
|
-
return value === null;
|
|
9
|
-
} catch {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region ../type-checks/src/is-empty.ts
|
|
16
|
-
/**
|
|
17
|
-
* Check if the provided value's type is `null` or `undefined`
|
|
18
|
-
*
|
|
19
|
-
* @param value - The value to type check
|
|
20
|
-
* @returns An indicator specifying if the value provided is of type `null` or `undefined`
|
|
21
|
-
*/
|
|
22
|
-
const isEmpty = (value) => {
|
|
23
|
-
try {
|
|
24
|
-
return isUndefined(value) || isNull(value);
|
|
25
|
-
} catch {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
//#endregion
|
|
31
|
-
//#region ../type-checks/src/is-set.ts
|
|
32
|
-
/**
|
|
33
|
-
* The inverse of the `isEmpty` function
|
|
34
|
-
*
|
|
35
|
-
* @param value - The value to type check
|
|
36
|
-
* @returns An indicator specifying if the value provided is **NOT** of type `null` or `undefined`
|
|
37
|
-
*/
|
|
38
|
-
const isSet = (value) => {
|
|
39
|
-
try {
|
|
40
|
-
return !isEmpty(value);
|
|
41
|
-
} catch {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
//#endregion
|
|
47
|
-
//#region ../type-checks/src/is-non-null-object.ts
|
|
48
|
-
/**
|
|
49
|
-
* Check if the provided value's type is `Object` and is not `null` or `undefined`
|
|
50
|
-
*
|
|
51
|
-
* @param value - The value to type check
|
|
52
|
-
* @returns An indicator specifying if the value provided is of type `Object` and is not `null` or `undefined`
|
|
53
|
-
*/
|
|
54
|
-
const isNonNullObject = (value) => {
|
|
55
|
-
return isSet(value) && isObject(value);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
//#endregion
|
|
59
|
-
//#region ../type-checks/src/is-set-object.ts
|
|
60
|
-
/**
|
|
61
|
-
* Check if the provided value's type is an object with some fields set
|
|
62
|
-
*
|
|
63
|
-
* @param value - The value to type check
|
|
64
|
-
* @returns An indicator specifying if the value provided is an object with some fields se
|
|
65
|
-
*/
|
|
66
|
-
const isSetObject = (value) => {
|
|
67
|
-
try {
|
|
68
|
-
return isNonNullObject(value) && Object.keys(value).length > 0;
|
|
69
|
-
} catch {
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
//#endregion
|
|
75
4
|
//#region src/pointer/find-reference.ts
|
|
76
5
|
const { isArray } = Array;
|
|
77
6
|
/**
|
|
@@ -132,4 +61,4 @@ const isObjectReference = (ref) => typeof ref.obj === "object" && typeof ref.key
|
|
|
132
61
|
|
|
133
62
|
//#endregion
|
|
134
63
|
export { isObjectReference as i, isArrayEnd as n, isArrayReference as r, find as t };
|
|
135
|
-
//# sourceMappingURL=find-reference-
|
|
64
|
+
//# sourceMappingURL=find-reference-DMSYEaaI.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-reference-DMSYEaaI.mjs","names":["obj: Reference[\"obj\"]","key: Reference[\"key\"]"],"sources":["../src/pointer/find-reference.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isString } from \"@stryke/type-checks/is-string\";\n\nexport interface Reference {\n /** Target value where pointer is pointing. */\n readonly val: unknown;\n /** Object which contains the target value. */\n readonly obj?: unknown | object | unknown[];\n /** Key which targets the target value in the object. */\n readonly key?: string | number;\n}\n\nconst { isArray } = Array;\n\n/**\n * Finds a target in document specified by JSON Pointer. Also returns the\n * object containing the target and key used to reference that object.\n *\n * Throws Error('NOT_FOUND') if pointer does not result into a value in the middle\n * of the path. If the last element of the path does not result into a value, the\n * lookup succeeds with `val` set to `undefined`. It can be used to discriminate\n * missing values, because `undefined` is not a valid JSON value.\n *\n * If last element in array is targeted using \"-\", e.g. \"/arr/-\", use\n * `isArrayEnd` to verify that:\n *\n * ```js\n * const ref = find({arr: [1, 2, 3], ['arr', '-']});\n * if (isArrayReference(ref)) {\n * if (isArrayEnd(ref)) {\n * // ...\n * }\n * }\n * ```\n *\n * @param val - Document to search in.\n * @param path - JSON Pointer path.\n * @returns Reference to the target.\n */\nexport const find = (val: unknown, path: Reference[\"key\"][]): Reference => {\n const pathLength = path.length;\n if (!pathLength) {\n return { val };\n }\n\n let obj: Reference[\"obj\"];\n let key: Reference[\"key\"];\n for (let i = 0; i < pathLength; i++) {\n obj = val;\n key = path[i];\n if (isArray(obj)) {\n const length = obj.length;\n if (key === \"-\") {\n key = length;\n } else if (isString(key)) {\n const key2 = Math.trunc(Number.parseInt(key));\n if (String(key2) !== key) {\n throw new Error(\"INVALID_INDEX\");\n }\n\n key = key2;\n if (key < 0) {\n throw new Error(\"INVALID_INDEX\");\n }\n }\n\n if (key) {\n val = obj[key];\n }\n } else if (isSetObject(obj)) {\n val = key && key in obj ? (obj as any)[key] : undefined;\n } else throw new Error(\"NOT_FOUND\");\n }\n const ref: Reference = {\n val,\n obj,\n key\n };\n\n return ref;\n};\n\nexport interface ArrayReference<T = unknown> {\n /** `undefined` in case JSON Pointer points to last element, e.g. \"/foo/-\". */\n readonly val: undefined | T;\n readonly obj: T[];\n readonly key: number;\n}\n\nexport const isArrayReference = <T = unknown>(\n ref: Reference\n): ref is ArrayReference<T> => isArray(ref.obj) && typeof ref.key === \"number\";\n\nexport const isArrayEnd = (ref: ArrayReference): boolean =>\n ref.obj.length === ref.key;\n\nexport interface ObjectReference<T = unknown> {\n readonly val: T;\n readonly obj: Record<string, T>;\n readonly key: string;\n}\n\nexport const isObjectReference = <T = unknown>(\n ref: Reference\n): ref is ObjectReference<T> =>\n typeof ref.obj === \"object\" && typeof ref.key === \"string\";\n"],"mappings":";;;;AA8BA,MAAM,EAAE,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BpB,MAAa,QAAQ,KAAc,SAAwC;CACzE,MAAM,aAAa,KAAK;AACxB,KAAI,CAAC,WACH,QAAO,EAAE,KAAK;CAGhB,IAAIA;CACJ,IAAIC;AACJ,MAAK,IAAI,IAAI,GAAG,IAAI,YAAY,KAAK;AACnC,QAAM;AACN,QAAM,KAAK;AACX,MAAI,QAAQ,IAAI,EAAE;GAChB,MAAM,SAAS,IAAI;AACnB,OAAI,QAAQ,IACV,OAAM;YACG,SAAS,IAAI,EAAE;IACxB,MAAM,OAAO,KAAK,MAAM,OAAO,SAAS,IAAI,CAAC;AAC7C,QAAI,OAAO,KAAK,KAAK,IACnB,OAAM,IAAI,MAAM,gBAAgB;AAGlC,UAAM;AACN,QAAI,MAAM,EACR,OAAM,IAAI,MAAM,gBAAgB;;AAIpC,OAAI,IACF,OAAM,IAAI;aAEH,YAAY,IAAI,CACzB,OAAM,OAAO,OAAO,MAAO,IAAY,OAAO;MACzC,OAAM,IAAI,MAAM,YAAY;;AAQrC,QANuB;EACrB;EACA;EACA;EACD;;AAYH,MAAa,oBACX,QAC6B,QAAQ,IAAI,IAAI,IAAI,OAAO,IAAI,QAAQ;AAEtE,MAAa,cAAc,QACzB,IAAI,IAAI,WAAW,IAAI;AAQzB,MAAa,qBACX,QAEA,OAAO,IAAI,QAAQ,YAAY,OAAO,IAAI,QAAQ"}
|
|
@@ -1,77 +1,6 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_is_undefined = require('./is-undefined-CnI0qe-z.cjs');
|
|
1
|
+
const require_is_set_object = require('./is-set-object-BmHip9em.cjs');
|
|
3
2
|
const require_is_string = require('./is-string-C2RK4Gjs.cjs');
|
|
4
3
|
|
|
5
|
-
//#region ../type-checks/src/is-null.ts
|
|
6
|
-
const isNull = (value) => {
|
|
7
|
-
try {
|
|
8
|
-
return value === null;
|
|
9
|
-
} catch {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region ../type-checks/src/is-empty.ts
|
|
16
|
-
/**
|
|
17
|
-
* Check if the provided value's type is `null` or `undefined`
|
|
18
|
-
*
|
|
19
|
-
* @param value - The value to type check
|
|
20
|
-
* @returns An indicator specifying if the value provided is of type `null` or `undefined`
|
|
21
|
-
*/
|
|
22
|
-
const isEmpty = (value) => {
|
|
23
|
-
try {
|
|
24
|
-
return require_is_undefined.isUndefined(value) || isNull(value);
|
|
25
|
-
} catch {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
//#endregion
|
|
31
|
-
//#region ../type-checks/src/is-set.ts
|
|
32
|
-
/**
|
|
33
|
-
* The inverse of the `isEmpty` function
|
|
34
|
-
*
|
|
35
|
-
* @param value - The value to type check
|
|
36
|
-
* @returns An indicator specifying if the value provided is **NOT** of type `null` or `undefined`
|
|
37
|
-
*/
|
|
38
|
-
const isSet = (value) => {
|
|
39
|
-
try {
|
|
40
|
-
return !isEmpty(value);
|
|
41
|
-
} catch {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
//#endregion
|
|
47
|
-
//#region ../type-checks/src/is-non-null-object.ts
|
|
48
|
-
/**
|
|
49
|
-
* Check if the provided value's type is `Object` and is not `null` or `undefined`
|
|
50
|
-
*
|
|
51
|
-
* @param value - The value to type check
|
|
52
|
-
* @returns An indicator specifying if the value provided is of type `Object` and is not `null` or `undefined`
|
|
53
|
-
*/
|
|
54
|
-
const isNonNullObject = (value) => {
|
|
55
|
-
return isSet(value) && require_is_object.isObject(value);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
//#endregion
|
|
59
|
-
//#region ../type-checks/src/is-set-object.ts
|
|
60
|
-
/**
|
|
61
|
-
* Check if the provided value's type is an object with some fields set
|
|
62
|
-
*
|
|
63
|
-
* @param value - The value to type check
|
|
64
|
-
* @returns An indicator specifying if the value provided is an object with some fields se
|
|
65
|
-
*/
|
|
66
|
-
const isSetObject = (value) => {
|
|
67
|
-
try {
|
|
68
|
-
return isNonNullObject(value) && Object.keys(value).length > 0;
|
|
69
|
-
} catch {
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
//#endregion
|
|
75
4
|
//#region src/pointer/find-reference.ts
|
|
76
5
|
const { isArray } = Array;
|
|
77
6
|
/**
|
|
@@ -117,7 +46,7 @@ const find = (val, path) => {
|
|
|
117
46
|
if (key < 0) throw new Error("INVALID_INDEX");
|
|
118
47
|
}
|
|
119
48
|
if (key) val = obj[key];
|
|
120
|
-
} else if (isSetObject(obj)) val = key && key in obj ? obj[key] : void 0;
|
|
49
|
+
} else if (require_is_set_object.isSetObject(obj)) val = key && key in obj ? obj[key] : void 0;
|
|
121
50
|
else throw new Error("NOT_FOUND");
|
|
122
51
|
}
|
|
123
52
|
return {
|
package/dist/index.cjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
const require_storm_json = require('./storm-json-
|
|
2
|
-
const require_find_reference = require('./find-reference-
|
|
3
|
-
const require_parse = require('./parse-
|
|
4
|
-
require('./pointer-
|
|
5
|
-
const require_schema = require('./schema-
|
|
6
|
-
const require_strip_comments = require('./strip-comments-
|
|
7
|
-
const require_parse$1 = require('./parse-
|
|
8
|
-
const require_code_frames = require('./code-frames-
|
|
9
|
-
const require_parse_error = require('./parse-error-
|
|
10
|
-
const require_stringify = require('./stringify-
|
|
1
|
+
const require_storm_json = require('./storm-json-BD6WFbrI.cjs');
|
|
2
|
+
const require_find_reference = require('./find-reference-De5vBQV2.cjs');
|
|
3
|
+
const require_parse = require('./parse-Bp6kkcQ4.cjs');
|
|
4
|
+
require('./pointer-B3W_Sme3.cjs');
|
|
5
|
+
const require_schema = require('./schema-Dl018Aq4.cjs');
|
|
6
|
+
const require_strip_comments = require('./strip-comments-CmEG_smS.cjs');
|
|
7
|
+
const require_parse$1 = require('./parse-ByDxRup5.cjs');
|
|
8
|
+
const require_code_frames = require('./code-frames-BmUvlJ0w.cjs');
|
|
9
|
+
const require_parse_error = require('./parse-error-N7UE-HMh.cjs');
|
|
10
|
+
const require_stringify = require('./stringify-BehjrfhS.cjs');
|
|
11
11
|
require('./types.cjs');
|
|
12
|
-
require('./utils-
|
|
12
|
+
require('./utils-jN2UkvqB.cjs');
|
|
13
13
|
|
|
14
14
|
exports.StormJSON = require_storm_json.StormJSON;
|
|
15
15
|
exports.codeFrameColumns = require_code_frames.codeFrameColumns;
|
|
@@ -22,8 +22,13 @@ exports.isArrayEnd = require_find_reference.isArrayEnd;
|
|
|
22
22
|
exports.isArrayReference = require_find_reference.isArrayReference;
|
|
23
23
|
exports.isInteger = require_parse.isInteger;
|
|
24
24
|
exports.isJsonSchema7AllOfType = require_schema.isJsonSchema7AllOfType;
|
|
25
|
+
exports.isJsonSchema7ArrayType = require_schema.isJsonSchema7ArrayType;
|
|
26
|
+
exports.isJsonSchema7LiteralType = require_schema.isJsonSchema7LiteralType;
|
|
27
|
+
exports.isJsonSchema7ObjectType = require_schema.isJsonSchema7ObjectType;
|
|
28
|
+
exports.isJsonSchema7PrimitiveLiteralType = require_schema.isJsonSchema7PrimitiveLiteralType;
|
|
25
29
|
exports.isObjectReference = require_find_reference.isObjectReference;
|
|
26
30
|
exports.isRoot = require_parse.isRoot;
|
|
31
|
+
exports.isStandardJsonSchema = require_schema.isStandardJsonSchema;
|
|
27
32
|
exports.isValidIndex = require_parse.isValidIndex;
|
|
28
33
|
exports.parent = require_parse.parent;
|
|
29
34
|
exports.parse = require_parse$1.parse;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
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
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
|
-
import { $ as
|
|
4
|
-
import { t as isJsonSchema7AllOfType } from "./schema-
|
|
5
|
-
import { t as StormJSON } from "./storm-json-
|
|
3
|
+
import { $ as TypeAnnotation, A as JsonSchema7PrimitiveLiteralType, B as JsonSchema7UndefinedType, C as JsonSchema7NativeEnumType, D as JsonSchema7NumberType, E as JsonSchema7NullableType, F as JsonSchema7SetType, G as Leaf, H as JsonSchema7UnknownType, I as JsonSchema7StringType, J as PrimitiveTypeAnnotation, K as LeafTypeAnnotation, L as JsonSchema7TupleType, M as JsonSchema7RecordPropertyNamesType, N as JsonSchema7RecordType, O as JsonSchema7ObjectType, P as JsonSchema7RefType, Q as Tree, R as JsonSchema7Type, S as JsonSchema7Meta, T as JsonSchema7NullType, U as JsonSerializeOptions, V as JsonSchema7UnionType, W as JsonValue, X as SimpleTypeAnnotation, Y as SerializableJsonValue, Z as SymbolTypeAnnotation, _ as JsonSchema7BooleanType, a as CustomTypeAnnotation, b as JsonSchema7LiteralType, c as JsonObject, d as JsonParserResult, et as TypedArrayAnnotation, f as JsonSchema7AllOfType, g as JsonSchema7BigintType, h as JsonSchema7ArrayType, i as CompositeTypeAnnotation, j as JsonSchema7PrimitiveUnionType, k as JsonSchema7Primitive, l as JsonParseOptions, m as JsonSchema7AnyType, n as ClassInstance, o as InnerNode, p as JsonSchema7AnyOfType, q as PrimitiveJsonValue, r as ClassTypeAnnotation, s as JsonArray, t as Class, u as JsonParserInterface, v as JsonSchema7DateType, w as JsonSchema7NeverType, x as JsonSchema7MapType, y as JsonSchema7EnumType, z as JsonSchema7TypeUnion } from "./types-Bn8rC098.cjs";
|
|
4
|
+
import { a as isJsonSchema7PrimitiveLiteralType, i as isJsonSchema7ObjectType, n as isJsonSchema7ArrayType, o as isStandardJsonSchema, r as isJsonSchema7LiteralType, t as isJsonSchema7AllOfType } from "./schema-BO1HCrxv.cjs";
|
|
5
|
+
import { t as StormJSON } from "./storm-json-DvIEWMEH.cjs";
|
|
6
6
|
import { t as codeFrameColumns } from "./code-frames-BUtrssZ5.cjs";
|
|
7
7
|
import { n as parse, r as safeParse, t as Options } from "./parse-BGlhbY16.cjs";
|
|
8
8
|
import { t as formatParseError } from "./parse-error-7K8s4vWf.cjs";
|
|
9
9
|
import { n as stringify, t as invalidKeyChars } from "./stringify-Bc8OkhIr.cjs";
|
|
10
10
|
import { t as stripComments } from "./strip-comments-Cz_Wc25t.cjs";
|
|
11
|
-
export { ArrayReference, Class, ClassInstance, ClassTypeAnnotation, CompositeTypeAnnotation, CustomTypeAnnotation, InnerNode, JsonArray, JsonObject, JsonParseOptions, JsonParserInterface, JsonParserResult, JsonSchema7AllOfType, JsonSchema7AnyOfType, JsonSchema7AnyType, JsonSchema7ArrayType, JsonSchema7BigintType, JsonSchema7BooleanType, JsonSchema7DateType, JsonSchema7EnumType, JsonSchema7LiteralType, JsonSchema7MapType, JsonSchema7Meta, JsonSchema7NativeEnumType, JsonSchema7NeverType, JsonSchema7NullType, JsonSchema7NullableType, JsonSchema7NumberType, JsonSchema7ObjectType, JsonSchema7Primitive, JsonSchema7PrimitiveUnionType, JsonSchema7RecordPropertyNamesType, JsonSchema7RecordType, JsonSchema7RefType, JsonSchema7SetType, JsonSchema7StringType, JsonSchema7TupleType, JsonSchema7Type, JsonSchema7TypeUnion, JsonSchema7UndefinedType, JsonSchema7UnionType, JsonSchema7UnknownType, JsonSerializeOptions, JsonValue, Leaf, LeafTypeAnnotation, ObjectReference, Options, PrimitiveJsonValue, PrimitiveTypeAnnotation, Reference, SerializableJsonValue, SimpleTypeAnnotation, StormJSON, SymbolTypeAnnotation, Tree, TypeAnnotation, TypedArrayAnnotation, codeFrameColumns, escapePointerSegment, find, formatJsonPointer, formatParseError, invalidKeyChars, isArrayEnd, isArrayReference, isInteger, isJsonSchema7AllOfType, isObjectReference, isRoot, isValidIndex, parent, parse, parseJsonPointer, safeParse, stringify, stripComments, unescapePointerSegment };
|
|
11
|
+
export { ArrayReference, Class, ClassInstance, ClassTypeAnnotation, CompositeTypeAnnotation, CustomTypeAnnotation, InnerNode, JsonArray, JsonObject, JsonParseOptions, JsonParserInterface, JsonParserResult, JsonSchema7AllOfType, JsonSchema7AnyOfType, JsonSchema7AnyType, JsonSchema7ArrayType, JsonSchema7BigintType, JsonSchema7BooleanType, JsonSchema7DateType, JsonSchema7EnumType, JsonSchema7LiteralType, JsonSchema7MapType, JsonSchema7Meta, JsonSchema7NativeEnumType, JsonSchema7NeverType, JsonSchema7NullType, JsonSchema7NullableType, JsonSchema7NumberType, JsonSchema7ObjectType, JsonSchema7Primitive, JsonSchema7PrimitiveLiteralType, JsonSchema7PrimitiveUnionType, JsonSchema7RecordPropertyNamesType, JsonSchema7RecordType, JsonSchema7RefType, JsonSchema7SetType, JsonSchema7StringType, JsonSchema7TupleType, JsonSchema7Type, JsonSchema7TypeUnion, JsonSchema7UndefinedType, JsonSchema7UnionType, JsonSchema7UnknownType, JsonSerializeOptions, JsonValue, Leaf, LeafTypeAnnotation, ObjectReference, Options, PrimitiveJsonValue, PrimitiveTypeAnnotation, Reference, SerializableJsonValue, SimpleTypeAnnotation, StormJSON, SymbolTypeAnnotation, Tree, TypeAnnotation, TypedArrayAnnotation, codeFrameColumns, escapePointerSegment, find, formatJsonPointer, formatParseError, invalidKeyChars, isArrayEnd, isArrayReference, isInteger, isJsonSchema7AllOfType, isJsonSchema7ArrayType, isJsonSchema7LiteralType, isJsonSchema7ObjectType, isJsonSchema7PrimitiveLiteralType, isObjectReference, isRoot, isStandardJsonSchema, isValidIndex, parent, parse, parseJsonPointer, safeParse, stringify, stripComments, unescapePointerSegment };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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-
|
|
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-
|
|
3
|
-
import { $ as
|
|
4
|
-
import { t as isJsonSchema7AllOfType } from "./schema-
|
|
5
|
-
import { t as StormJSON } from "./storm-json-
|
|
6
|
-
import { t as codeFrameColumns } from "./code-frames-
|
|
7
|
-
import { n as parse, r as safeParse, t as Options } from "./parse-
|
|
8
|
-
import { t as formatParseError } from "./parse-error-
|
|
9
|
-
import { n as stringify, t as invalidKeyChars } from "./stringify-
|
|
10
|
-
import { t as stripComments } from "./strip-comments-
|
|
11
|
-
import "./index-
|
|
12
|
-
export { ArrayReference, Class, ClassInstance, ClassTypeAnnotation, CompositeTypeAnnotation, CustomTypeAnnotation, InnerNode, JsonArray, JsonObject, JsonParseOptions, JsonParserInterface, JsonParserResult, JsonSchema7AllOfType, JsonSchema7AnyOfType, JsonSchema7AnyType, JsonSchema7ArrayType, JsonSchema7BigintType, JsonSchema7BooleanType, JsonSchema7DateType, JsonSchema7EnumType, JsonSchema7LiteralType, JsonSchema7MapType, JsonSchema7Meta, JsonSchema7NativeEnumType, JsonSchema7NeverType, JsonSchema7NullType, JsonSchema7NullableType, JsonSchema7NumberType, JsonSchema7ObjectType, JsonSchema7Primitive, JsonSchema7PrimitiveUnionType, JsonSchema7RecordPropertyNamesType, JsonSchema7RecordType, JsonSchema7RefType, JsonSchema7SetType, JsonSchema7StringType, JsonSchema7TupleType, JsonSchema7Type, JsonSchema7TypeUnion, JsonSchema7UndefinedType, JsonSchema7UnionType, JsonSchema7UnknownType, JsonSerializeOptions, JsonValue, Leaf, LeafTypeAnnotation, ObjectReference, Options, PrimitiveJsonValue, PrimitiveTypeAnnotation, Reference, SerializableJsonValue, SimpleTypeAnnotation, StormJSON, SymbolTypeAnnotation, Tree, TypeAnnotation, TypedArrayAnnotation, codeFrameColumns, escapePointerSegment, find, formatJsonPointer, formatParseError, invalidKeyChars, isArrayEnd, isArrayReference, isInteger, isJsonSchema7AllOfType, isObjectReference, isRoot, isValidIndex, parent, parse, parseJsonPointer, safeParse, stringify, stripComments, unescapePointerSegment };
|
|
1
|
+
import { a as isArrayEnd, i as find, n as ObjectReference, o as isArrayReference, r as Reference, s as isObjectReference, t as ArrayReference } from "./find-reference-B8xshNXL.mjs";
|
|
2
|
+
import { a as isValidIndex, c as unescapePointerSegment, i as isRoot, n as formatJsonPointer, o as parent, r as isInteger, s as parseJsonPointer, t as escapePointerSegment } from "./parse-Cj-YfhrI.mjs";
|
|
3
|
+
import { $ as TypeAnnotation, A as JsonSchema7PrimitiveLiteralType, B as JsonSchema7UndefinedType, C as JsonSchema7NativeEnumType, D as JsonSchema7NumberType, E as JsonSchema7NullableType, F as JsonSchema7SetType, G as Leaf, H as JsonSchema7UnknownType, I as JsonSchema7StringType, J as PrimitiveTypeAnnotation, K as LeafTypeAnnotation, L as JsonSchema7TupleType, M as JsonSchema7RecordPropertyNamesType, N as JsonSchema7RecordType, O as JsonSchema7ObjectType, P as JsonSchema7RefType, Q as Tree, R as JsonSchema7Type, S as JsonSchema7Meta, T as JsonSchema7NullType, U as JsonSerializeOptions, V as JsonSchema7UnionType, W as JsonValue, X as SimpleTypeAnnotation, Y as SerializableJsonValue, Z as SymbolTypeAnnotation, _ as JsonSchema7BooleanType, a as CustomTypeAnnotation, b as JsonSchema7LiteralType, c as JsonObject, d as JsonParserResult, et as TypedArrayAnnotation, f as JsonSchema7AllOfType, g as JsonSchema7BigintType, h as JsonSchema7ArrayType, i as CompositeTypeAnnotation, j as JsonSchema7PrimitiveUnionType, k as JsonSchema7Primitive, l as JsonParseOptions, m as JsonSchema7AnyType, n as ClassInstance, o as InnerNode, p as JsonSchema7AnyOfType, q as PrimitiveJsonValue, r as ClassTypeAnnotation, s as JsonArray, t as Class, u as JsonParserInterface, v as JsonSchema7DateType, w as JsonSchema7NeverType, x as JsonSchema7MapType, y as JsonSchema7EnumType, z as JsonSchema7TypeUnion } from "./types-CPQlxauZ.mjs";
|
|
4
|
+
import { a as isJsonSchema7PrimitiveLiteralType, i as isJsonSchema7ObjectType, n as isJsonSchema7ArrayType, o as isStandardJsonSchema, r as isJsonSchema7LiteralType, t as isJsonSchema7AllOfType } from "./schema-CmH1V_uI.mjs";
|
|
5
|
+
import { t as StormJSON } from "./storm-json-8F9CKpXu.mjs";
|
|
6
|
+
import { t as codeFrameColumns } from "./code-frames-CrTAYYSE.mjs";
|
|
7
|
+
import { n as parse, r as safeParse, t as Options } from "./parse-fXy5pbmE.mjs";
|
|
8
|
+
import { t as formatParseError } from "./parse-error-DpEv3vo_.mjs";
|
|
9
|
+
import { n as stringify, t as invalidKeyChars } from "./stringify-CFT1K1LE.mjs";
|
|
10
|
+
import { t as stripComments } from "./strip-comments-BA8MS_Fs.mjs";
|
|
11
|
+
import "./index-CCt0lwyI.mjs";
|
|
12
|
+
export { ArrayReference, Class, ClassInstance, ClassTypeAnnotation, CompositeTypeAnnotation, CustomTypeAnnotation, InnerNode, JsonArray, JsonObject, JsonParseOptions, JsonParserInterface, JsonParserResult, JsonSchema7AllOfType, JsonSchema7AnyOfType, JsonSchema7AnyType, JsonSchema7ArrayType, JsonSchema7BigintType, JsonSchema7BooleanType, JsonSchema7DateType, JsonSchema7EnumType, JsonSchema7LiteralType, JsonSchema7MapType, JsonSchema7Meta, JsonSchema7NativeEnumType, JsonSchema7NeverType, JsonSchema7NullType, JsonSchema7NullableType, JsonSchema7NumberType, JsonSchema7ObjectType, JsonSchema7Primitive, JsonSchema7PrimitiveLiteralType, JsonSchema7PrimitiveUnionType, JsonSchema7RecordPropertyNamesType, JsonSchema7RecordType, JsonSchema7RefType, JsonSchema7SetType, JsonSchema7StringType, JsonSchema7TupleType, JsonSchema7Type, JsonSchema7TypeUnion, JsonSchema7UndefinedType, JsonSchema7UnionType, JsonSchema7UnknownType, JsonSerializeOptions, JsonValue, Leaf, LeafTypeAnnotation, ObjectReference, Options, PrimitiveJsonValue, PrimitiveTypeAnnotation, Reference, SerializableJsonValue, SimpleTypeAnnotation, StormJSON, SymbolTypeAnnotation, Tree, TypeAnnotation, TypedArrayAnnotation, codeFrameColumns, escapePointerSegment, find, formatJsonPointer, formatParseError, invalidKeyChars, isArrayEnd, isArrayReference, isInteger, isJsonSchema7AllOfType, isJsonSchema7ArrayType, isJsonSchema7LiteralType, isJsonSchema7ObjectType, isJsonSchema7PrimitiveLiteralType, isObjectReference, isRoot, isStandardJsonSchema, isValidIndex, parent, parse, parseJsonPointer, safeParse, stringify, stripComments, unescapePointerSegment };
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { i as isObjectReference, n as isArrayEnd, r as isArrayReference, t as find } from "./find-reference-
|
|
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-
|
|
3
|
-
import "./pointer-
|
|
4
|
-
import { t as isJsonSchema7AllOfType } from "./schema-
|
|
5
|
-
import { t as stripComments } from "./strip-comments-
|
|
6
|
-
import { n as safeParse, t as parse } from "./parse-
|
|
7
|
-
import { t as codeFrameColumns } from "./code-frames-
|
|
8
|
-
import { t as formatParseError } from "./parse-error-
|
|
9
|
-
import { n as stringify, t as invalidKeyChars } from "./stringify-
|
|
10
|
-
import { t as StormJSON } from "./storm-json-
|
|
1
|
+
import { i as isObjectReference, n as isArrayEnd, r as isArrayReference, t as find } from "./find-reference-DMSYEaaI.mjs";
|
|
2
|
+
import { a as isValidIndex, c as unescapePointerSegment, i as isRoot, n as formatJsonPointer, o as parent, r as isInteger, s as parseJsonPointer, t as escapePointerSegment } from "./parse-vw_qRD3F.mjs";
|
|
3
|
+
import "./pointer-Dn__XOdY.mjs";
|
|
4
|
+
import { a as isJsonSchema7PrimitiveLiteralType, i as isJsonSchema7ObjectType, n as isJsonSchema7ArrayType, o as isStandardJsonSchema, r as isJsonSchema7LiteralType, t as isJsonSchema7AllOfType } from "./schema-DGmzxHja.mjs";
|
|
5
|
+
import { t as stripComments } from "./strip-comments-Dq00N_Sg.mjs";
|
|
6
|
+
import { n as safeParse, t as parse } from "./parse-Dn43ZK9y.mjs";
|
|
7
|
+
import { t as codeFrameColumns } from "./code-frames-DuBfTMu4.mjs";
|
|
8
|
+
import { t as formatParseError } from "./parse-error-Af4zHUQ_.mjs";
|
|
9
|
+
import { n as stringify, t as invalidKeyChars } from "./stringify-CYHjAvWm.mjs";
|
|
10
|
+
import { t as StormJSON } from "./storm-json-nkhJgTz4.mjs";
|
|
11
11
|
import "./types.mjs";
|
|
12
|
-
import "./utils-
|
|
12
|
+
import "./utils-mEkKIcgl.mjs";
|
|
13
13
|
|
|
14
|
-
export { StormJSON, codeFrameColumns, escapePointerSegment, find, formatJsonPointer, formatParseError, invalidKeyChars, isArrayEnd, isArrayReference, isInteger, isJsonSchema7AllOfType, isObjectReference, isRoot, isValidIndex, parent, parse, parseJsonPointer, safeParse, stringify, stripComments, unescapePointerSegment };
|
|
14
|
+
export { StormJSON, codeFrameColumns, escapePointerSegment, find, formatJsonPointer, formatParseError, invalidKeyChars, isArrayEnd, isArrayReference, isInteger, isJsonSchema7AllOfType, isJsonSchema7ArrayType, isJsonSchema7LiteralType, isJsonSchema7ObjectType, isJsonSchema7PrimitiveLiteralType, isObjectReference, isRoot, isStandardJsonSchema, isValidIndex, parent, parse, parseJsonPointer, safeParse, stringify, stripComments, unescapePointerSegment };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
const require_is_number = require('./is-number-c5xguIbS.cjs');
|
|
2
|
+
const require_is_object = require('./is-object-umGh91v1.cjs');
|
|
3
|
+
const require_is_undefined = require('./is-undefined-CnI0qe-z.cjs');
|
|
4
|
+
|
|
5
|
+
//#region ../type-checks/src/is-function.ts
|
|
6
|
+
function isSyncFunction(value) {
|
|
7
|
+
return require_is_number.getObjectTag(value) === "[object Function]";
|
|
8
|
+
}
|
|
9
|
+
function isAsyncFunction(value) {
|
|
10
|
+
return require_is_number.getObjectTag(value) === "[object AsyncFunction]";
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Check if the provided value's type is `Function`
|
|
14
|
+
*
|
|
15
|
+
* @param value - The value to type check
|
|
16
|
+
* @returns An indicator specifying if the value provided is of type `Function`
|
|
17
|
+
*/
|
|
18
|
+
const isFunction = (value) => {
|
|
19
|
+
try {
|
|
20
|
+
return value instanceof Function || typeof value === "function" || Boolean(value?.constructor && value?.call && value?.apply) || isSyncFunction(value) || isAsyncFunction(value);
|
|
21
|
+
} catch {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region ../type-checks/src/is-null.ts
|
|
28
|
+
const isNull = (value) => {
|
|
29
|
+
try {
|
|
30
|
+
return value === null;
|
|
31
|
+
} catch {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region ../type-checks/src/is-empty.ts
|
|
38
|
+
/**
|
|
39
|
+
* Check if the provided value's type is `null` or `undefined`
|
|
40
|
+
*
|
|
41
|
+
* @param value - The value to type check
|
|
42
|
+
* @returns An indicator specifying if the value provided is of type `null` or `undefined`
|
|
43
|
+
*/
|
|
44
|
+
const isEmpty = (value) => {
|
|
45
|
+
try {
|
|
46
|
+
return require_is_undefined.isUndefined(value) || isNull(value);
|
|
47
|
+
} catch {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region ../type-checks/src/is-set.ts
|
|
54
|
+
/**
|
|
55
|
+
* The inverse of the `isEmpty` function
|
|
56
|
+
*
|
|
57
|
+
* @param value - The value to type check
|
|
58
|
+
* @returns An indicator specifying if the value provided is **NOT** of type `null` or `undefined`
|
|
59
|
+
*/
|
|
60
|
+
const isSet = (value) => {
|
|
61
|
+
try {
|
|
62
|
+
return !isEmpty(value);
|
|
63
|
+
} catch {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region ../type-checks/src/is-non-null-object.ts
|
|
70
|
+
/**
|
|
71
|
+
* Check if the provided value's type is `Object` and is not `null` or `undefined`
|
|
72
|
+
*
|
|
73
|
+
* @param value - The value to type check
|
|
74
|
+
* @returns An indicator specifying if the value provided is of type `Object` and is not `null` or `undefined`
|
|
75
|
+
*/
|
|
76
|
+
const isNonNullObject = (value) => {
|
|
77
|
+
return isSet(value) && require_is_object.isObject(value);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region ../type-checks/src/is-set-object.ts
|
|
82
|
+
/**
|
|
83
|
+
* Check if the provided value's type is an object with some fields set
|
|
84
|
+
*
|
|
85
|
+
* @param value - The value to type check
|
|
86
|
+
* @returns An indicator specifying if the value provided is an object with some fields se
|
|
87
|
+
*/
|
|
88
|
+
const isSetObject = (value) => {
|
|
89
|
+
try {
|
|
90
|
+
return isNonNullObject(value) && Object.keys(value).length > 0;
|
|
91
|
+
} catch {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
97
|
+
Object.defineProperty(exports, 'isFunction', {
|
|
98
|
+
enumerable: true,
|
|
99
|
+
get: function () {
|
|
100
|
+
return isFunction;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
Object.defineProperty(exports, 'isSetObject', {
|
|
104
|
+
enumerable: true,
|
|
105
|
+
get: function () {
|
|
106
|
+
return isSetObject;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { n as getObjectTag } from "./is-number-BIwzZzyi.mjs";
|
|
2
|
+
import { t as isObject } from "./is-object-BpfmzHWa.mjs";
|
|
3
|
+
import { t as isUndefined } from "./is-undefined-CmyJWYGD.mjs";
|
|
4
|
+
|
|
5
|
+
//#region ../type-checks/src/is-function.ts
|
|
6
|
+
function isSyncFunction(value) {
|
|
7
|
+
return getObjectTag(value) === "[object Function]";
|
|
8
|
+
}
|
|
9
|
+
function isAsyncFunction(value) {
|
|
10
|
+
return getObjectTag(value) === "[object AsyncFunction]";
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Check if the provided value's type is `Function`
|
|
14
|
+
*
|
|
15
|
+
* @param value - The value to type check
|
|
16
|
+
* @returns An indicator specifying if the value provided is of type `Function`
|
|
17
|
+
*/
|
|
18
|
+
const isFunction = (value) => {
|
|
19
|
+
try {
|
|
20
|
+
return value instanceof Function || typeof value === "function" || Boolean(value?.constructor && value?.call && value?.apply) || isSyncFunction(value) || isAsyncFunction(value);
|
|
21
|
+
} catch {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region ../type-checks/src/is-null.ts
|
|
28
|
+
const isNull = (value) => {
|
|
29
|
+
try {
|
|
30
|
+
return value === null;
|
|
31
|
+
} catch {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region ../type-checks/src/is-empty.ts
|
|
38
|
+
/**
|
|
39
|
+
* Check if the provided value's type is `null` or `undefined`
|
|
40
|
+
*
|
|
41
|
+
* @param value - The value to type check
|
|
42
|
+
* @returns An indicator specifying if the value provided is of type `null` or `undefined`
|
|
43
|
+
*/
|
|
44
|
+
const isEmpty = (value) => {
|
|
45
|
+
try {
|
|
46
|
+
return isUndefined(value) || isNull(value);
|
|
47
|
+
} catch {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region ../type-checks/src/is-set.ts
|
|
54
|
+
/**
|
|
55
|
+
* The inverse of the `isEmpty` function
|
|
56
|
+
*
|
|
57
|
+
* @param value - The value to type check
|
|
58
|
+
* @returns An indicator specifying if the value provided is **NOT** of type `null` or `undefined`
|
|
59
|
+
*/
|
|
60
|
+
const isSet = (value) => {
|
|
61
|
+
try {
|
|
62
|
+
return !isEmpty(value);
|
|
63
|
+
} catch {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region ../type-checks/src/is-non-null-object.ts
|
|
70
|
+
/**
|
|
71
|
+
* Check if the provided value's type is `Object` and is not `null` or `undefined`
|
|
72
|
+
*
|
|
73
|
+
* @param value - The value to type check
|
|
74
|
+
* @returns An indicator specifying if the value provided is of type `Object` and is not `null` or `undefined`
|
|
75
|
+
*/
|
|
76
|
+
const isNonNullObject = (value) => {
|
|
77
|
+
return isSet(value) && isObject(value);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region ../type-checks/src/is-set-object.ts
|
|
82
|
+
/**
|
|
83
|
+
* Check if the provided value's type is an object with some fields set
|
|
84
|
+
*
|
|
85
|
+
* @param value - The value to type check
|
|
86
|
+
* @returns An indicator specifying if the value provided is an object with some fields se
|
|
87
|
+
*/
|
|
88
|
+
const isSetObject = (value) => {
|
|
89
|
+
try {
|
|
90
|
+
return isNonNullObject(value) && Object.keys(value).length > 0;
|
|
91
|
+
} catch {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
97
|
+
export { isFunction as n, isSetObject as t };
|
|
98
|
+
//# sourceMappingURL=is-set-object-C1Qnj1Q8.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-set-object-C1Qnj1Q8.mjs","names":[],"sources":["../../type-checks/src/is-function.ts","../../type-checks/src/is-null.ts","../../type-checks/src/is-empty.ts","../../type-checks/src/is-set.ts","../../type-checks/src/is-non-null-object.ts","../../type-checks/src/is-set-object.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { AnyFunction } from \"@stryke/types/base\";\nimport { getObjectTag } from \"./get-object-tag\";\n\nexport function isSyncFunction(value?: any): value is AnyFunction {\n return getObjectTag(value) === \"[object Function]\";\n}\n\nexport function isAsyncFunction(value?: any): value is AnyFunction {\n return getObjectTag(value) === \"[object AsyncFunction]\";\n}\n\n/**\n * Check if the provided value's type is `Function`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `Function`\n */\nexport const isFunction = (value: unknown): value is AnyFunction => {\n try {\n return (\n value instanceof Function ||\n typeof value === \"function\" ||\n Boolean(\n value?.constructor && (value as any)?.call && (value as any)?.apply\n ) ||\n isSyncFunction(value) ||\n isAsyncFunction(value)\n );\n } catch {\n return false;\n }\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const isNull = (value: unknown): value is null => {\n try {\n return value === null;\n } catch {\n return false;\n }\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isDate } from \"./is-date\";\nimport { isFunction } from \"./is-function\";\nimport { isNull } from \"./is-null\";\nimport { isNumber } from \"./is-number\";\nimport { isSymbol } from \"./is-symbol\";\nimport { isUndefined } from \"./is-undefined\";\n\n/**\n * Check if the provided value's type is `null` or `undefined`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `null` or `undefined`\n */\nexport const isEmpty = (value: unknown) => {\n try {\n return isUndefined(value) || isNull(value);\n } catch {\n return false;\n }\n};\n\nexport const isEmptyAnything = (value: any) => {\n if (value === true || value === false) return true;\n if (value === null || value === undefined) return true;\n if (isNumber(value)) return value === 0;\n if (isDate(value)) return Number.isNaN(value.getTime());\n if (isFunction(value)) return false;\n if (isSymbol(value)) return false;\n const { length } = value;\n if (isNumber(length)) return length === 0;\n const { size } = value;\n if (isNumber(size)) return size === 0;\n const keys = Object.keys(value).length;\n\n return keys === 0;\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isEmpty } from \"./is-empty\";\n\n/**\n * The inverse of the `isEmpty` function\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is **NOT** of type `null` or `undefined`\n */\nexport const isSet = (value: unknown): value is NonNullable<unknown> => {\n try {\n return !isEmpty(value);\n } catch {\n return false;\n }\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isObject } from \"./is-object\";\nimport { isSet } from \"./is-set\";\n\n/**\n * Check if the provided value's type is `Object` and is not `null` or `undefined`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `Object` and is not `null` or `undefined`\n */\nexport const isNonNullObject = (value: any): value is NonNullable<object> => {\n return isSet(value) && isObject(value);\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isNonNullObject } from \"./is-non-null-object\";\n\n/**\n * Check if the provided value's type is an object with some fields set\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is an object with some fields se\n */\nexport const isSetObject = (value: unknown): value is NonNullable<object> => {\n try {\n return isNonNullObject(value) && Object.keys(value).length > 0;\n } catch {\n return false;\n }\n};\n"],"mappings":";;;;;AAqBA,SAAgB,eAAe,OAAmC;AAChE,QAAO,aAAa,MAAM,KAAK;;AAGjC,SAAgB,gBAAgB,OAAmC;AACjE,QAAO,aAAa,MAAM,KAAK;;;;;;;;AASjC,MAAa,cAAc,UAAyC;AAClE,KAAI;AACF,SACE,iBAAiB,YACjB,OAAO,UAAU,cACjB,QACE,OAAO,eAAgB,OAAe,QAAS,OAAe,MAC/D,IACD,eAAe,MAAM,IACrB,gBAAgB,MAAM;SAElB;AACN,SAAO;;;;;;AC7BX,MAAa,UAAU,UAAkC;AACvD,KAAI;AACF,SAAO,UAAU;SACX;AACN,SAAO;;;;;;;;;;;;ACSX,MAAa,WAAW,UAAmB;AACzC,KAAI;AACF,SAAO,YAAY,MAAM,IAAI,OAAO,MAAM;SACpC;AACN,SAAO;;;;;;;;;;;;ACTX,MAAa,SAAS,UAAkD;AACtE,KAAI;AACF,SAAO,CAAC,QAAQ,MAAM;SAChB;AACN,SAAO;;;;;;;;;;;;ACHX,MAAa,mBAAmB,UAA6C;AAC3E,QAAO,MAAM,MAAM,IAAI,SAAS,MAAM;;;;;;;;;;;ACFxC,MAAa,eAAe,UAAiD;AAC3E,KAAI;AACF,SAAO,gBAAgB,MAAM,IAAI,OAAO,KAAK,MAAM,CAAC,SAAS;SACvD;AACN,SAAO"}
|