@stryke/json 0.9.15 → 0.9.23
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 +404 -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
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# Changelog for Stryke - JSON
|
|
4
|
+
|
|
5
|
+
## [0.9.22](https://github.com/storm-software/stryke/releases/tag/json%400.9.22) (12/07/2025)
|
|
6
|
+
|
|
7
|
+
### Updated Dependencies
|
|
8
|
+
|
|
9
|
+
- Updated **type-checks** to **v0.5.4**
|
|
10
|
+
- Updated **types** to **v0.10.18**
|
|
11
|
+
|
|
12
|
+
## [0.9.21](https://github.com/storm-software/stryke/releases/tag/json%400.9.21) (12/07/2025)
|
|
13
|
+
|
|
14
|
+
### Miscellaneous
|
|
15
|
+
|
|
16
|
+
- **monorepo:** Format monorepo source files
|
|
17
|
+
([9428936](https://github.com/storm-software/stryke/commit/9428936))
|
|
18
|
+
|
|
19
|
+
### Updated Dependencies
|
|
20
|
+
|
|
21
|
+
- Updated **type-checks** to **v0.5.3**
|
|
22
|
+
- Updated **types** to **v0.10.17**
|
|
23
|
+
|
|
24
|
+
## [0.9.20](https://github.com/storm-software/stryke/releases/tag/json%400.9.20) (12/06/2025)
|
|
25
|
+
|
|
26
|
+
### Features
|
|
27
|
+
|
|
28
|
+
- **tools-nx:** Resolved issue inferring build command-line arguments for local
|
|
29
|
+
packages ([de00278](https://github.com/storm-software/stryke/commit/de00278))
|
|
30
|
+
|
|
31
|
+
### Updated Dependencies
|
|
32
|
+
|
|
33
|
+
- Updated **type-checks** to **v0.5.2**
|
|
34
|
+
- Updated **types** to **v0.10.16**
|
|
35
|
+
|
|
36
|
+
## [0.9.19](https://github.com/storm-software/stryke/releases/tag/json%400.9.19) (12/06/2025)
|
|
37
|
+
|
|
38
|
+
### Updated Dependencies
|
|
39
|
+
|
|
40
|
+
- Updated **type-checks** to **v0.5.1**
|
|
41
|
+
- Updated **types** to **v0.10.15**
|
|
42
|
+
|
|
43
|
+
## [0.9.18](https://github.com/storm-software/stryke/releases/tag/json%400.9.18) (12/05/2025)
|
|
44
|
+
|
|
45
|
+
### Updated Dependencies
|
|
46
|
+
|
|
47
|
+
- Updated **type-checks** to **v0.5.0**
|
|
48
|
+
|
|
49
|
+
## [0.9.17](https://github.com/storm-software/stryke/releases/tag/json%400.9.17) (12/05/2025)
|
|
50
|
+
|
|
51
|
+
### Features
|
|
52
|
+
|
|
53
|
+
- **monorepo:** Update repository to use `tsdown` to build/bundle packages
|
|
54
|
+
([8ceb909](https://github.com/storm-software/stryke/commit/8ceb909))
|
|
55
|
+
|
|
56
|
+
### Updated Dependencies
|
|
57
|
+
|
|
58
|
+
- Updated **type-checks** to **v0.4.5**
|
|
59
|
+
- Updated **types** to **v0.10.14**
|
|
60
|
+
|
|
61
|
+
## [0.9.16](https://github.com/storm-software/stryke/releases/tag/json%400.9.16) (12/01/2025)
|
|
62
|
+
|
|
63
|
+
### Updated Dependencies
|
|
64
|
+
|
|
65
|
+
- Updated **type-checks** to **v0.4.4**
|
|
66
|
+
- Updated **types** to **v0.10.13**
|
|
67
|
+
|
|
68
|
+
## [0.9.15](https://github.com/storm-software/stryke/releases/tag/json%400.9.15) (11/30/2025)
|
|
69
|
+
|
|
70
|
+
### Updated Dependencies
|
|
71
|
+
|
|
72
|
+
- Updated **type-checks** to **v0.4.3**
|
|
73
|
+
- Updated **types** to **v0.10.12**
|
|
74
|
+
|
|
75
|
+
## [0.9.14](https://github.com/storm-software/stryke/releases/tag/json%400.9.14) (11/30/2025)
|
|
76
|
+
|
|
77
|
+
### Updated Dependencies
|
|
78
|
+
|
|
79
|
+
- Updated **type-checks** to **v0.4.2**
|
|
80
|
+
- Updated **types** to **v0.10.11**
|
|
81
|
+
|
|
82
|
+
## [0.9.13](https://github.com/storm-software/stryke/releases/tag/json%400.9.13) (11/30/2025)
|
|
83
|
+
|
|
84
|
+
### Updated Dependencies
|
|
85
|
+
|
|
86
|
+
- Updated **type-checks** to **v0.4.1**
|
|
87
|
+
- Updated **types** to **v0.10.10**
|
|
88
|
+
|
|
89
|
+
## [0.9.12](https://github.com/storm-software/stryke/releases/tag/json%400.9.12) (11/30/2025)
|
|
90
|
+
|
|
91
|
+
### Updated Dependencies
|
|
92
|
+
|
|
93
|
+
- Updated **type-checks** to **v0.4.0**
|
|
94
|
+
- Updated **types** to **v0.10.9**
|
|
95
|
+
|
|
96
|
+
## [0.9.11](https://github.com/storm-software/stryke/releases/tag/json%400.9.11) (11/24/2025)
|
|
97
|
+
|
|
98
|
+
### Updated Dependencies
|
|
99
|
+
|
|
100
|
+
- Updated **type-checks** to **v0.3.18**
|
|
101
|
+
- Updated **types** to **v0.10.8**
|
|
102
|
+
|
|
103
|
+
## [0.9.10](https://github.com/storm-software/stryke/releases/tag/json%400.9.10) (11/21/2025)
|
|
104
|
+
|
|
105
|
+
### Updated Dependencies
|
|
106
|
+
|
|
107
|
+
- Updated **type-checks** to **v0.3.17**
|
|
108
|
+
- Updated **types** to **v0.10.7**
|
|
109
|
+
|
|
110
|
+
## [0.9.9](https://github.com/storm-software/stryke/releases/tag/json%400.9.9) (11/21/2025)
|
|
111
|
+
|
|
112
|
+
### Updated Dependencies
|
|
113
|
+
|
|
114
|
+
- Updated **type-checks** to **v0.3.16**
|
|
115
|
+
- Updated **types** to **v0.10.6**
|
|
116
|
+
|
|
117
|
+
## [0.9.8](https://github.com/storm-software/stryke/releases/tag/json%400.9.8) (11/21/2025)
|
|
118
|
+
|
|
119
|
+
### Updated Dependencies
|
|
120
|
+
|
|
121
|
+
- Updated **type-checks** to **v0.3.15**
|
|
122
|
+
- Updated **types** to **v0.10.5**
|
|
123
|
+
|
|
124
|
+
## [0.9.7](https://github.com/storm-software/stryke/releases/tag/json%400.9.7) (11/21/2025)
|
|
125
|
+
|
|
126
|
+
### Updated Dependencies
|
|
127
|
+
|
|
128
|
+
- Updated **type-checks** to **v0.3.14**
|
|
129
|
+
- Updated **types** to **v0.10.4**
|
|
130
|
+
|
|
131
|
+
## [0.9.6](https://github.com/storm-software/stryke/releases/tag/json%400.9.6) (11/21/2025)
|
|
132
|
+
|
|
133
|
+
### Updated Dependencies
|
|
134
|
+
|
|
135
|
+
- Updated **type-checks** to **v0.3.13**
|
|
136
|
+
- Updated **types** to **v0.10.3**
|
|
137
|
+
|
|
138
|
+
## [0.9.5](https://github.com/storm-software/stryke/releases/tag/json%400.9.5) (11/16/2025)
|
|
139
|
+
|
|
140
|
+
### Updated Dependencies
|
|
141
|
+
|
|
142
|
+
- Updated **type-checks** to **v0.3.12**
|
|
143
|
+
- Updated **types** to **v0.10.2**
|
|
144
|
+
|
|
145
|
+
## [0.9.4](https://github.com/storm-software/stryke/releases/tag/json%400.9.4) (11/08/2025)
|
|
146
|
+
|
|
147
|
+
### Updated Dependencies
|
|
148
|
+
|
|
149
|
+
- Updated **type-checks** to **v0.3.11**
|
|
150
|
+
- Updated **types** to **v0.10.1**
|
|
151
|
+
|
|
152
|
+

|
|
153
|
+
|
|
154
|
+
# Changelog for Stryke - JSON
|
|
155
|
+
|
|
156
|
+
## [0.9.3](https://github.com/storm-software/stryke/releases/tag/json%400.9.3) (2025-08-04)
|
|
157
|
+
|
|
158
|
+
### Bug Fixes
|
|
159
|
+
|
|
160
|
+
- **monorepo:** Resolved repository type-check failures
|
|
161
|
+
([d196ace](https://github.com/storm-software/stryke/commit/d196ace))
|
|
162
|
+
|
|
163
|
+

|
|
164
|
+
|
|
165
|
+
# Changelog for Stryke - Json
|
|
166
|
+
|
|
167
|
+
## [0.9.2](https://github.com/storm-software/stryke/releases/tag/json%400.9.2) (2025-06-17)
|
|
168
|
+
|
|
169
|
+
### Miscellaneous
|
|
170
|
+
|
|
171
|
+
- **monorepo:** Reformat repository packages
|
|
172
|
+
|
|
173
|
+
## [0.9.1](https://github.com/storm-software/stryke/releases/tag/json%400.9.1) (2025-06-12)
|
|
174
|
+
|
|
175
|
+
### Miscellaneous
|
|
176
|
+
|
|
177
|
+
- **monorepo:** Reformat the repository's README markdown files
|
|
178
|
+
- **monorepo:** Run format script on repository
|
|
179
|
+
|
|
180
|
+
## [0.9.0](https://github.com/storm-software/stryke/releases/tag/json%400.9.0) (2025-06-02)
|
|
181
|
+
|
|
182
|
+
### Features
|
|
183
|
+
|
|
184
|
+
- **fs:** Improve the `loadTsConfig` handler function
|
|
185
|
+
|
|
186
|
+
## [0.8.3](https://github.com/storm-software/stryke/releases/tag/json%400.8.3) (2025-05-27)
|
|
187
|
+
|
|
188
|
+
### Bug Fixes
|
|
189
|
+
|
|
190
|
+
- **json:** Remove the invalid `Buffer` import path
|
|
191
|
+
|
|
192
|
+
## [0.8.2](https://github.com/storm-software/stryke/releases/tag/json%400.8.2) (2025-05-12)
|
|
193
|
+
|
|
194
|
+
### Miscellaneous
|
|
195
|
+
|
|
196
|
+
- **monorepo:** Reformat monorepo source code
|
|
197
|
+
|
|
198
|
+
## [0.8.1](https://github.com/storm-software/stryke/releases/tag/json%400.8.1) (2025-04-25)
|
|
199
|
+
|
|
200
|
+
### Bug Fixes
|
|
201
|
+
|
|
202
|
+
- **json:** Added missing characters to invalid key list
|
|
203
|
+
([3b83500](https://github.com/storm-software/stryke/commit/3b83500))
|
|
204
|
+
|
|
205
|
+
## [0.8.0](https://github.com/storm-software/stryke/releases/tag/json%400.8.0) (2025-04-25)
|
|
206
|
+
|
|
207
|
+
### Features
|
|
208
|
+
|
|
209
|
+
- **json:** Update `stringify` to handle invalid characters
|
|
210
|
+
([2163417](https://github.com/storm-software/stryke/commit/2163417))
|
|
211
|
+
|
|
212
|
+
## [0.7.3](https://github.com/storm-software/stryke/releases/tag/json%400.7.3) (2025-04-23)
|
|
213
|
+
|
|
214
|
+
### Miscellaneous
|
|
215
|
+
|
|
216
|
+
- **json:** Only export `StormJSON` and types from index
|
|
217
|
+
([d96dd89](https://github.com/storm-software/stryke/commit/d96dd89))
|
|
218
|
+
|
|
219
|
+
## [0.7.2](https://github.com/storm-software/stryke/releases/tag/json%400.7.2) (2025-04-22)
|
|
220
|
+
|
|
221
|
+
### Bug Fixes
|
|
222
|
+
|
|
223
|
+
- **json:** Resolve issue with serializing `undefined` values in JSONs
|
|
224
|
+
([0f6acec](https://github.com/storm-software/stryke/commit/0f6acec))
|
|
225
|
+
|
|
226
|
+
## [0.7.1](https://github.com/storm-software/stryke/releases/tag/json%400.7.1) (2025-04-10)
|
|
227
|
+
|
|
228
|
+
### Miscellaneous
|
|
229
|
+
|
|
230
|
+
- **monorepo:** Format the repository's files
|
|
231
|
+
([1384f3e](https://github.com/storm-software/stryke/commit/1384f3e))
|
|
232
|
+
|
|
233
|
+
## [0.7.0](https://github.com/storm-software/stryke/releases/tag/json%400.7.0) (2025-04-07)
|
|
234
|
+
|
|
235
|
+
### Features
|
|
236
|
+
|
|
237
|
+
- **http:** Added the `StormURL` helper class
|
|
238
|
+
([03643b0](https://github.com/storm-software/stryke/commit/03643b0))
|
|
239
|
+
|
|
240
|
+
## [0.6.1](https://github.com/storm-software/stryke/releases/tag/json%400.6.1) (2025-04-07)
|
|
241
|
+
|
|
242
|
+
### Miscellaneous
|
|
243
|
+
|
|
244
|
+
- **json:** Improve json parsing helper
|
|
245
|
+
([81a7e12](https://github.com/storm-software/stryke/commit/81a7e12))
|
|
246
|
+
|
|
247
|
+
## [0.6.0](https://github.com/storm-software/stryke/releases/tag/json%400.6.0) (2025-04-07)
|
|
248
|
+
|
|
249
|
+
### Features
|
|
250
|
+
|
|
251
|
+
- **json:** Added custom parsing logic
|
|
252
|
+
([fd5a86a](https://github.com/storm-software/stryke/commit/fd5a86a))
|
|
253
|
+
|
|
254
|
+
## [0.5.8](https://github.com/storm-software/stryke/releases/tag/json%400.5.8) (2025-04-07)
|
|
255
|
+
|
|
256
|
+
### Bug Fixes
|
|
257
|
+
|
|
258
|
+
- **json:** Resolve issue with invalid json parsing
|
|
259
|
+
([5e57aaa](https://github.com/storm-software/stryke/commit/5e57aaa))
|
|
260
|
+
|
|
261
|
+
## [0.5.7](https://github.com/storm-software/stryke/releases/tag/json%400.5.7) (2025-04-07)
|
|
262
|
+
|
|
263
|
+
### Bug Fixes
|
|
264
|
+
|
|
265
|
+
- **json:** Resolve issue with nested string value
|
|
266
|
+
([f7a1043](https://github.com/storm-software/stryke/commit/f7a1043))
|
|
267
|
+
|
|
268
|
+
## [0.5.6](https://github.com/storm-software/stryke/releases/tag/json%400.5.6) (2025-04-07)
|
|
269
|
+
|
|
270
|
+
### Bug Fixes
|
|
271
|
+
|
|
272
|
+
- **json:** Resolve issue with `json` prefix in string result
|
|
273
|
+
([23ca1c5](https://github.com/storm-software/stryke/commit/23ca1c5))
|
|
274
|
+
|
|
275
|
+
## [0.5.5](https://github.com/storm-software/stryke/releases/tag/json%400.5.5) (2025-04-07)
|
|
276
|
+
|
|
277
|
+
### Bug Fixes
|
|
278
|
+
|
|
279
|
+
- **json:** Resovle issue with `stringify` function handler
|
|
280
|
+
([72fbdb9](https://github.com/storm-software/stryke/commit/72fbdb9))
|
|
281
|
+
|
|
282
|
+
## [0.5.4](https://github.com/storm-software/stryke/releases/tag/json%400.5.4) (2025-03-28)
|
|
283
|
+
|
|
284
|
+
### Miscellaneous
|
|
285
|
+
|
|
286
|
+
- **monorepo:** Reformat the source files in repository
|
|
287
|
+
([bb8df2c](https://github.com/storm-software/stryke/commit/bb8df2c))
|
|
288
|
+
|
|
289
|
+
## [0.5.3](https://github.com/storm-software/stryke/releases/tag/json%400.5.3) (2025-03-23)
|
|
290
|
+
|
|
291
|
+
### Bug Fixes
|
|
292
|
+
|
|
293
|
+
- **monorepo:** Resolve issue with TypeScript compilation
|
|
294
|
+
([72e995f](https://github.com/storm-software/stryke/commit/72e995f))
|
|
295
|
+
|
|
296
|
+
## [0.5.2](https://github.com/storm-software/stryke/releases/tag/json%400.5.2) (2025-03-23)
|
|
297
|
+
|
|
298
|
+
### Miscellaneous
|
|
299
|
+
|
|
300
|
+
- **monorepo:** Update base storm software packages
|
|
301
|
+
([8942201](https://github.com/storm-software/stryke/commit/8942201))
|
|
302
|
+
|
|
303
|
+
## 0.5.1 (2025-03-13)
|
|
304
|
+
|
|
305
|
+
### Miscellaneous
|
|
306
|
+
|
|
307
|
+
- **monorepo:** Format monorepo project files
|
|
308
|
+
([f28fdbe](https://github.com/storm-software/stryke/commit/f28fdbe))
|
|
309
|
+
|
|
310
|
+
## 0.5.0 (2025-03-13)
|
|
311
|
+
|
|
312
|
+
### Features
|
|
313
|
+
|
|
314
|
+
- **monorepo:** Split `types` project into `type-checks` and `convert` packages
|
|
315
|
+
([fcc5832](https://github.com/storm-software/stryke/commit/fcc5832))
|
|
316
|
+
|
|
317
|
+
## 0.4.3 (2025-03-13)
|
|
318
|
+
|
|
319
|
+
### Miscellaneous
|
|
320
|
+
|
|
321
|
+
- **monorepo:** Reformat monorepo package files
|
|
322
|
+
([a453428](https://github.com/storm-software/stryke/commit/a453428))
|
|
323
|
+
|
|
324
|
+
## 0.4.2 (2025-02-26)
|
|
325
|
+
|
|
326
|
+
### Miscellaneous
|
|
327
|
+
|
|
328
|
+
- **monorepo:** Reformat monorepo files with `prettier`
|
|
329
|
+
([b5d0302](https://github.com/storm-software/stryke/commit/b5d0302))
|
|
330
|
+
|
|
331
|
+
## 0.4.1 (2025-02-24)
|
|
332
|
+
|
|
333
|
+
### Bug Fixes
|
|
334
|
+
|
|
335
|
+
- **json:** Update JSON stringify method
|
|
336
|
+
([06a7482](https://github.com/storm-software/stryke/commit/06a7482))
|
|
337
|
+
|
|
338
|
+
## 0.4.0 (2025-02-24)
|
|
339
|
+
|
|
340
|
+
### Features
|
|
341
|
+
|
|
342
|
+
- **json:** Update the JSON stringify function signature
|
|
343
|
+
([3f2c1c8](https://github.com/storm-software/stryke/commit/3f2c1c8))
|
|
344
|
+
|
|
345
|
+
### Bug Fixes
|
|
346
|
+
|
|
347
|
+
- **json:** Resolve issue stringifying json result
|
|
348
|
+
([99a05a9](https://github.com/storm-software/stryke/commit/99a05a9))
|
|
349
|
+
|
|
350
|
+
## 0.3.0 (2025-02-24)
|
|
351
|
+
|
|
352
|
+
### Features
|
|
353
|
+
|
|
354
|
+
- **json:** Update method signature on stringify functions
|
|
355
|
+
([f4b9300](https://github.com/storm-software/stryke/commit/f4b9300))
|
|
356
|
+
|
|
357
|
+
## 0.2.1 (2025-02-24)
|
|
358
|
+
|
|
359
|
+
### Bug Fixes
|
|
360
|
+
|
|
361
|
+
- **json:** Resolve issue with stringifying json values
|
|
362
|
+
([df99f22](https://github.com/storm-software/stryke/commit/df99f22))
|
|
363
|
+
|
|
364
|
+
## 0.2.0 (2025-02-23)
|
|
365
|
+
|
|
366
|
+
### Features
|
|
367
|
+
|
|
368
|
+
- **monorepo:** Update base ESLint packages and run on files
|
|
369
|
+
([c59cb8e](https://github.com/storm-software/stryke/commit/c59cb8e))
|
|
370
|
+
|
|
371
|
+
## 0.1.4 (2025-02-17)
|
|
372
|
+
|
|
373
|
+
### Miscellaneous
|
|
374
|
+
|
|
375
|
+
- **monorepo:** Reformat monorepo files
|
|
376
|
+
([1db5e06](https://github.com/storm-software/stryke/commit/1db5e06))
|
|
377
|
+
|
|
378
|
+
## 0.1.3 (2025-02-15)
|
|
379
|
+
|
|
380
|
+
### Miscellaneous
|
|
381
|
+
|
|
382
|
+
- **monorepo:** Reformat monorepo files
|
|
383
|
+
([69ed6b7](https://github.com/storm-software/stryke/commit/69ed6b7))
|
|
384
|
+
|
|
385
|
+
## 0.1.2 (2025-02-15)
|
|
386
|
+
|
|
387
|
+
### Miscellaneous
|
|
388
|
+
|
|
389
|
+
- **monorepo:** Reformat workspace files
|
|
390
|
+
([ad2d6a9](https://github.com/storm-software/stryke/commit/ad2d6a9))
|
|
391
|
+
|
|
392
|
+
## 0.1.1 (2025-02-09)
|
|
393
|
+
|
|
394
|
+
### Miscellaneous
|
|
395
|
+
|
|
396
|
+
- **monorepo:** Regenerate repository markdown files
|
|
397
|
+
([e61e39e](https://github.com/storm-software/stryke/commit/e61e39e))
|
|
398
|
+
|
|
399
|
+
## 0.1.0 (2025-02-07)
|
|
400
|
+
|
|
401
|
+
### Bug Fixes
|
|
402
|
+
|
|
403
|
+
- **cli:** Resolve typing issue with `figlet` dependency
|
|
404
|
+
([2ad7747](https://github.com/storm-software/stryke/commit/2ad7747))
|
package/README.md
CHANGED
|
@@ -3,7 +3,13 @@
|
|
|
3
3
|
<!-- markdownlint-disable -->
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
<div align="center"
|
|
6
|
+
<div align="center">
|
|
7
|
+
<picture>
|
|
8
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://public.storm-cdn.com/storm-software/banner-1280x640-dark-optimized.gif">
|
|
9
|
+
<source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/storm-software/banner-1280x640-light-optimized.gif">
|
|
10
|
+
<img src="https://public.storm-cdn.com/storm-software/banner-1280x640-dark-optimized.gif" width="100%" alt="Storm Software" />
|
|
11
|
+
</picture>
|
|
12
|
+
</div>
|
|
7
13
|
<br />
|
|
8
14
|
|
|
9
15
|
<div align="center">
|
|
@@ -16,13 +22,13 @@
|
|
|
16
22
|
</div>
|
|
17
23
|
|
|
18
24
|
<br />
|
|
19
|
-
This package is part of Storm Software's
|
|
25
|
+
This package is part of Storm Software's **💥 Stryke** monorepo. Stryke packages TypeScript utility packages with shared functionality common to many Storm Software applications.
|
|
20
26
|
|
|
21
27
|
<br />
|
|
22
28
|
|
|
23
29
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
24
30
|
|
|
25
|
-
[](https://prettier.io/) [](http://nx.dev/) [](https://nextjs.org/) [](http://commitizen.github.io/cz-cli/)  [](https://fumadocs.vercel.app/) 
|
|
26
32
|
|
|
27
33
|
> [!IMPORTANT] Important
|
|
28
34
|
> This repository, and the apps, libraries, and tools contained within, is still in it's initial development phase. As a result, bugs and issues are expected with it's usage. When the main development phase completes, a proper release will be performed, the packages will be available through NPM (and other distributions), and this message will be removed. However, in the meantime, please feel free to report any issues you may come across.
|
|
@@ -94,10 +100,10 @@ yarn add -D @stryke/json
|
|
|
94
100
|
|
|
95
101
|
## Reduced Package Size
|
|
96
102
|
|
|
97
|
-
This project uses [
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
103
|
+
This project uses [tsdown](https://tsdown.dev) to package the source code due to
|
|
104
|
+
its ability to remove unused code and ship smaller javascript files thanks to
|
|
105
|
+
code splitting. This helps to greatly reduce the size of the package and to make
|
|
106
|
+
it easier to use in other projects.
|
|
101
107
|
|
|
102
108
|
## Development
|
|
103
109
|
|
|
@@ -238,10 +244,13 @@ specification. Contributions of any kind welcome!
|
|
|
238
244
|
<br />
|
|
239
245
|
|
|
240
246
|
<hr />
|
|
241
|
-
<br />
|
|
242
247
|
|
|
243
248
|
<div align="center">
|
|
244
|
-
<
|
|
249
|
+
<picture>
|
|
250
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://public.storm-cdn.com/storm-software/banner-1280x320-dark-optimized.webp">
|
|
251
|
+
<source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/storm-software/banner-1280x320-light-optimized.webp">
|
|
252
|
+
<img src="https://public.storm-cdn.com/storm-software/banner-1280x320-dark-optimized.webp" width="100%" alt="Storm Software" />
|
|
253
|
+
</picture>
|
|
245
254
|
</div>
|
|
246
255
|
<br />
|
|
247
256
|
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const e=/\r\n|[\n\r\u2028\u2029]/;function t(e,t,n={}){let r={column:0,line:-1,...e.start},i={...r,...e.end},{linesAbove:a=2,linesBelow:o=3}=n||{},s=r.line,c=r.column,l=i.line,u=i.column,d=Math.max(s-(a+1),0),f=Math.min(t.length,l+o);s===-1&&(d=0),l===-1&&(f=t.length);let p=l-s,m={};if(p)for(let e=0;e<=p;e++){let n=e+s;c?e===0?m[n]=[c,(t[n-1]?.length??0)-c+1]:e===p?m[n]=[0,u]:m[n]=[0,t[n-e]?.length??0]:m[n]=!0}else c===u?m[s]=c?[c,0]:!0:m[s]=[c,u-c];return{start:d,end:f,markerLines:m}}function n(n,r,i={}){let{start:a,end:o,markerLines:s}=t(r,n.split(e),i),c=String(o).length;return(i.highlight?i.highlight(n):n).split(e).slice(a,o).map((e,t)=>{let n=a+1+t,r=` ${` ${n}`.slice(-c)} | `,i=!!(s[n]??!1);if(i){let t=``;if(Array.isArray(i)){let n=e.slice(0,Math.max(i[0]-1,0)).replace(/[^\t]/g,` `),a=i[1]||1;t=[`
|
|
2
|
+
`,r.replace(/\d/g,` `),n,`^`.repeat(a)].join(``)}return[`>`,r,e,t].join(``)}return` ${r}${e}`}).join(`
|
|
3
|
+
`)}export{n as t};
|
|
4
|
+
//# sourceMappingURL=code-frames-BQI7PKd_.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-frames-BQI7PKd_.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,EAAU,0BAKhB,SAAS,EACP,EACA,EACA,EAAqD,EAAE,CAKvD,CACA,IAAMA,EAAqB,CACzB,OAAQ,EACR,KAAM,GACN,GAAG,EAAI,MACR,CACKC,EAAmB,CACvB,GAAG,EACH,GAAG,EAAI,IACR,CACK,CAAE,aAAa,EAAG,aAAa,GAAM,GAAQ,EAAE,CAC/C,EAAY,EAAS,KACrB,EAAc,EAAS,OACvB,EAAU,EAAO,KACjB,EAAY,EAAO,OAErB,EAAQ,KAAK,IAAI,GAAa,EAAa,GAAI,EAAE,CACjD,EAAM,KAAK,IAAI,EAAO,OAAQ,EAAU,EAAW,CAEnD,IAAc,KAChB,EAAQ,GAGN,IAAY,KACd,EAAM,EAAO,QAGf,IAAM,EAAW,EAAU,EACrB,EAAc,EAAE,CAEtB,GAAI,EACF,IAAK,IAAI,EAAI,EAAG,GAAK,EAAU,IAAK,CAClC,IAAM,EAAa,EAAI,EAElB,EAEM,IAAM,EAGf,EAAY,GAAc,CAAC,GAFN,EAAO,EAAa,IAAI,QAAU,GAEA,EAAc,EAAE,CAC9D,IAAM,EACf,EAAY,GAAc,CAAC,EAAG,EAAU,CAIxC,EAAY,GAAc,CAAC,EAFN,EAAO,EAAa,IAAI,QAAU,EAEZ,CAV3C,EAAY,GAAc,QAarB,IAAgB,EACzB,EAAY,GAAa,EAAc,CAAC,EAAa,EAAE,CAAG,GAE1D,EAAY,GAAa,CAAC,EAAa,EAAY,EAAY,CAGjE,MAAO,CACL,QACA,MACA,cACD,CAGH,SAAgB,EACd,EACA,EACA,EAII,EAAE,CACE,CAER,GAAM,CAAE,QAAO,MAAK,eAAgB,EAAe,EADrC,EAAS,MAAM,EAAQ,CAC0B,EAAK,CAE9D,EAAiB,OAAO,EAAI,CAAC,OAgCnC,OA/ByB,EAAK,UAAY,EAAK,UAAU,EAAS,CAAG,GAGlE,MAAM,EAAQ,CACd,MAAM,EAAO,EAAI,CACjB,KAAK,EAAM,IAAU,CACpB,IAAM,EAAS,EAAQ,EAAI,EAErB,EAAS,IADM,IAAI,IAAS,MAAM,CAAC,EAAe,CACxB,KAC1B,EAAY,GAAQ,EAAY,IAAW,IACjD,GAAI,EAAW,CACb,IAAI,EAAa,GACjB,GAAI,MAAM,QAAQ,EAAU,CAAE,CAC5B,IAAM,EAAgB,EACnB,MAAM,EAAG,KAAK,IAAI,EAAU,GAAK,EAAG,EAAE,CAAC,CACvC,QAAQ,SAAU,IAAI,CACnB,EAAkB,EAAU,IAAM,EAExC,EAAa,CACX;GACA,EAAO,QAAQ,MAAO,IAAI,CAC1B,EACA,IAAI,OAAO,EAAgB,CAC5B,CAAC,KAAK,GAAG,CAEZ,MAAO,CAAC,IAAK,EAAQ,EAAM,EAAW,CAAC,KAAK,GAAG,CAEjD,MAAO,IAAI,IAAS,KACpB,CACD,KAAK;EAAK"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/utils/code-frames.d.ts
|
|
2
|
+
interface Location {
|
|
3
|
+
column: number;
|
|
4
|
+
line: number;
|
|
5
|
+
}
|
|
6
|
+
interface NodeLocation {
|
|
7
|
+
end?: Location;
|
|
8
|
+
start?: Location;
|
|
9
|
+
}
|
|
10
|
+
declare function codeFrameColumns(rawLines: string, loc: NodeLocation, opts?: {
|
|
11
|
+
linesAbove?: number;
|
|
12
|
+
linesBelow?: number;
|
|
13
|
+
highlight?: (rawLines: string) => string;
|
|
14
|
+
}): string;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { codeFrameColumns as t };
|
|
17
|
+
//# sourceMappingURL=code-frames-CXX37tnR.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-frames-CXX37tnR.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"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const e=/\r\n|[\n\r\u2028\u2029]/;function t(e,t,n={}){let r={column:0,line:-1,...e.start},i={...r,...e.end},{linesAbove:a=2,linesBelow:o=3}=n||{},s=r.line,c=r.column,l=i.line,u=i.column,d=Math.max(s-(a+1),0),f=Math.min(t.length,l+o);s===-1&&(d=0),l===-1&&(f=t.length);let p=l-s,m={};if(p)for(let e=0;e<=p;e++){let n=e+s;c?e===0?m[n]=[c,(t[n-1]?.length??0)-c+1]:e===p?m[n]=[0,u]:m[n]=[0,t[n-e]?.length??0]:m[n]=!0}else c===u?m[s]=c?[c,0]:!0:m[s]=[c,u-c];return{start:d,end:f,markerLines:m}}function n(n,r,i={}){let{start:a,end:o,markerLines:s}=t(r,n.split(e),i),c=String(o).length;return(i.highlight?i.highlight(n):n).split(e).slice(a,o).map((e,t)=>{let n=a+1+t,r=` ${` ${n}`.slice(-c)} | `,i=!!(s[n]??!1);if(i){let t=``;if(Array.isArray(i)){let n=e.slice(0,Math.max(i[0]-1,0)).replace(/[^\t]/g,` `),a=i[1]||1;t=[`
|
|
2
|
+
`,r.replace(/\d/g,` `),n,`^`.repeat(a)].join(``)}return[`>`,r,e,t].join(``)}return` ${r}${e}`}).join(`
|
|
3
|
+
`)}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return n}});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/utils/code-frames.d.ts
|
|
2
|
+
interface Location {
|
|
3
|
+
column: number;
|
|
4
|
+
line: number;
|
|
5
|
+
}
|
|
6
|
+
interface NodeLocation {
|
|
7
|
+
end?: Location;
|
|
8
|
+
start?: Location;
|
|
9
|
+
}
|
|
10
|
+
declare function codeFrameColumns(rawLines: string, loc: NodeLocation, opts?: {
|
|
11
|
+
linesAbove?: number;
|
|
12
|
+
linesBelow?: number;
|
|
13
|
+
highlight?: (rawLines: string) => string;
|
|
14
|
+
}): string;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { codeFrameColumns as t };
|
|
17
|
+
//# sourceMappingURL=code-frames-DViwqU8S.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-frames-DViwqU8S.d.cts","names":[],"sources":["../src/utils/code-frames.ts"],"sourcesContent":[],"mappings":";UAkBU,QAAA;EAAA,MAAA,EAAA,MAAQ;EAKR,IAAA,EAAA,MAAA;AAoFV;UApFU,YAAA;QACF;UACE;;iBAkFM,gBAAA,wBAET"}
|
|
@@ -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-AvNORSzC.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-reference-AvNORSzC.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"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as e}from"./is-object-DDPbtSWR.mjs";import{t}from"./is-string-VB7nGKjX.mjs";import{t as n}from"./is-undefined-D6sfLkFq.mjs";const r=e=>{try{return e===null}catch{return!1}},i=e=>{try{return n(e)||r(e)}catch{return!1}},a=e=>{try{return!i(e)}catch{return!1}},o=t=>a(t)&&e(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(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`;export{f as i,d as n,u as r,l as t};
|
|
2
|
+
//# sourceMappingURL=find-reference-BUIYIOS4.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-reference-BUIYIOS4.mjs","names":["obj: Reference[\"obj\"]","key: Reference[\"key\"]"],"sources":["../../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","../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\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","/* -------------------------------------------------------------------\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":"qIAkBA,MAAa,EAAU,GAAkC,CACvD,GAAI,CACF,OAAO,IAAU,UACX,CACN,MAAO,KCSE,EAAW,GAAmB,CACzC,GAAI,CACF,OAAO,EAAY,EAAM,EAAI,EAAO,EAAM,MACpC,CACN,MAAO,KCTE,EAAS,GAAkD,CACtE,GAAI,CACF,MAAO,CAAC,EAAQ,EAAM,MAChB,CACN,MAAO,KCHE,EAAmB,GACvB,EAAM,EAAM,EAAI,EAAS,EAAM,CCF3B,EAAe,GAAiD,CAC3E,GAAI,CACF,OAAO,EAAgB,EAAM,EAAI,OAAO,KAAK,EAAM,CAAC,OAAS,OACvD,CACN,MAAO,KCAL,CAAE,WAAY,MA2BP,GAAQ,EAAc,IAAwC,CACzE,IAAM,EAAa,EAAK,OACxB,GAAI,CAAC,EACH,MAAO,CAAE,MAAK,CAGhB,IAAIA,EACAC,EACJ,IAAK,IAAI,EAAI,EAAG,EAAI,EAAY,IAG9B,GAFA,EAAM,EACN,EAAM,EAAK,GACP,EAAQ,EAAI,CAAE,CAChB,IAAM,EAAS,EAAI,OACnB,GAAI,IAAQ,IACV,EAAM,UACG,EAAS,EAAI,CAAE,CACxB,IAAM,EAAO,KAAK,MAAM,OAAO,SAAS,EAAI,CAAC,CAM7C,GALI,OAAO,EAAK,GAAK,IAIrB,EAAM,EACF,EAAM,GACR,MAAU,MAAM,gBAAgB,CAIhC,IACF,EAAM,EAAI,YAEH,EAAY,EAAI,CACzB,EAAM,GAAO,KAAO,EAAO,EAAY,GAAO,IAAA,QACzC,MAAU,MAAM,YAAY,CAQrC,MANuB,CACrB,MACA,MACA,MACD,EAYU,EACX,GAC6B,EAAQ,EAAI,IAAI,EAAI,OAAO,EAAI,KAAQ,SAEzD,EAAc,GACzB,EAAI,IAAI,SAAW,EAAI,IAQZ,EACX,GAEA,OAAO,EAAI,KAAQ,UAAY,OAAO,EAAI,KAAQ"}
|