@calcit/procs 0.9.4 → 0.9.6
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/lib/js-cirru.mjs +11 -11
- package/lib/package.json +3 -3
- package/package.json +3 -3
- package/ts-src/js-cirru.mts +11 -11
package/lib/js-cirru.mjs
CHANGED
|
@@ -220,11 +220,11 @@ export let extract_cirru_edn = (x, options) => {
|
|
|
220
220
|
return parseFloat(x);
|
|
221
221
|
}
|
|
222
222
|
// strict behavior as Rust semantics
|
|
223
|
-
throw new Error(
|
|
223
|
+
throw new Error(`unknown syntax for EDN: ${x}`);
|
|
224
224
|
}
|
|
225
225
|
if (x instanceof Array) {
|
|
226
226
|
if (x.length === 0) {
|
|
227
|
-
throw new Error("Cannot be empty");
|
|
227
|
+
throw new Error("Cannot be empty form");
|
|
228
228
|
}
|
|
229
229
|
if (x[0] === "{}") {
|
|
230
230
|
let result = [];
|
|
@@ -239,11 +239,11 @@ export let extract_cirru_edn = (x, options) => {
|
|
|
239
239
|
result.push(extract_cirru_edn(pair[0], options), extract_cirru_edn(pair[1], options));
|
|
240
240
|
}
|
|
241
241
|
else {
|
|
242
|
-
throw new Error(`Expected a pair, got
|
|
242
|
+
throw new Error(`Expected a pair, got: ${pair}`);
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
else {
|
|
246
|
-
throw new Error(`Expected pairs for map, got ${pair}`);
|
|
246
|
+
throw new Error(`Expected pairs for map, got: ${pair}`);
|
|
247
247
|
}
|
|
248
248
|
});
|
|
249
249
|
return new CalcitSliceMap(result);
|
|
@@ -251,7 +251,7 @@ export let extract_cirru_edn = (x, options) => {
|
|
|
251
251
|
if (x[0] === "%{}") {
|
|
252
252
|
let name = x[1];
|
|
253
253
|
if (typeof name != "string") {
|
|
254
|
-
throw new Error(
|
|
254
|
+
throw new Error(`Expected string for record name, got: ${name}`);
|
|
255
255
|
}
|
|
256
256
|
// put to entries first, sort and then...
|
|
257
257
|
let entries = [];
|
|
@@ -267,15 +267,15 @@ export let extract_cirru_edn = (x, options) => {
|
|
|
267
267
|
entries.push([extractFieldTag(pair[0]), extract_cirru_edn(pair[1], options)]);
|
|
268
268
|
}
|
|
269
269
|
else {
|
|
270
|
-
throw new Error(
|
|
270
|
+
throw new Error(`Expected string as field, got: ${pair}`);
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
else {
|
|
274
|
-
throw new Error(
|
|
274
|
+
throw new Error(`Expected pair of size 2, got: ${pair}`);
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
else {
|
|
278
|
-
throw new Error(
|
|
278
|
+
throw new Error(`Expected pairs for reocrd, got: ${pair}`);
|
|
279
279
|
}
|
|
280
280
|
});
|
|
281
281
|
entries.sort((a, b) => {
|
|
@@ -321,13 +321,13 @@ export let extract_cirru_edn = (x, options) => {
|
|
|
321
321
|
}
|
|
322
322
|
if (x[0] === "quote") {
|
|
323
323
|
if (x.length !== 2) {
|
|
324
|
-
throw new Error(
|
|
324
|
+
throw new Error(`quote expects 1 argument, got: ${x}`);
|
|
325
325
|
}
|
|
326
326
|
return new CalcitCirruQuote(x[1]);
|
|
327
327
|
}
|
|
328
328
|
if (x[0] === "::") {
|
|
329
329
|
if (x.length < 2) {
|
|
330
|
-
throw new Error(
|
|
330
|
+
throw new Error(`tuple expects at least 1 value, got: ${x}`);
|
|
331
331
|
}
|
|
332
332
|
return new CalcitTuple(extract_cirru_edn(x[1], options), x
|
|
333
333
|
.slice(2)
|
|
@@ -336,7 +336,7 @@ export let extract_cirru_edn = (x, options) => {
|
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
338
|
console.error(x);
|
|
339
|
-
throw new Error(
|
|
339
|
+
throw new Error(`Unexpected data from EDN: ${x}`);
|
|
340
340
|
};
|
|
341
341
|
export let format_cirru_edn = (data, useInline = true) => {
|
|
342
342
|
if (data == null) {
|
package/lib/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@calcit/procs",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.6",
|
|
4
4
|
"main": "./lib/calcit.procs.mjs",
|
|
5
5
|
"devDependencies": {
|
|
6
|
-
"@types/node": "^22.
|
|
7
|
-
"typescript": "^5.
|
|
6
|
+
"@types/node": "^22.8.7",
|
|
7
|
+
"typescript": "^5.6.3"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"compile": "rm -rfv lib/* && tsc",
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@calcit/procs",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.6",
|
|
4
4
|
"main": "./lib/calcit.procs.mjs",
|
|
5
5
|
"devDependencies": {
|
|
6
|
-
"@types/node": "^22.
|
|
7
|
-
"typescript": "^5.
|
|
6
|
+
"@types/node": "^22.8.7",
|
|
7
|
+
"typescript": "^5.6.3"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"compile": "rm -rfv lib/* && tsc",
|
package/ts-src/js-cirru.mts
CHANGED
|
@@ -217,11 +217,11 @@ export let extract_cirru_edn = (x: CirruEdnFormat, options: CalcitValue): Calcit
|
|
|
217
217
|
return parseFloat(x);
|
|
218
218
|
}
|
|
219
219
|
// strict behavior as Rust semantics
|
|
220
|
-
throw new Error(
|
|
220
|
+
throw new Error(`unknown syntax for EDN: ${x}`);
|
|
221
221
|
}
|
|
222
222
|
if (x instanceof Array) {
|
|
223
223
|
if (x.length === 0) {
|
|
224
|
-
throw new Error("Cannot be empty");
|
|
224
|
+
throw new Error("Cannot be empty form");
|
|
225
225
|
}
|
|
226
226
|
if (x[0] === "{}") {
|
|
227
227
|
let result: Array<CalcitValue> = [];
|
|
@@ -234,10 +234,10 @@ export let extract_cirru_edn = (x: CirruEdnFormat, options: CalcitValue): Calcit
|
|
|
234
234
|
if (pair.length === 2) {
|
|
235
235
|
result.push(extract_cirru_edn(pair[0], options), extract_cirru_edn(pair[1], options));
|
|
236
236
|
} else {
|
|
237
|
-
throw new Error(`Expected a pair, got
|
|
237
|
+
throw new Error(`Expected a pair, got: ${pair}`);
|
|
238
238
|
}
|
|
239
239
|
} else {
|
|
240
|
-
throw new Error(`Expected pairs for map, got ${pair}`);
|
|
240
|
+
throw new Error(`Expected pairs for map, got: ${pair}`);
|
|
241
241
|
}
|
|
242
242
|
});
|
|
243
243
|
return new CalcitSliceMap(result);
|
|
@@ -245,7 +245,7 @@ export let extract_cirru_edn = (x: CirruEdnFormat, options: CalcitValue): Calcit
|
|
|
245
245
|
if (x[0] === "%{}") {
|
|
246
246
|
let name = x[1];
|
|
247
247
|
if (typeof name != "string") {
|
|
248
|
-
throw new Error(
|
|
248
|
+
throw new Error(`Expected string for record name, got: ${name}`);
|
|
249
249
|
}
|
|
250
250
|
// put to entries first, sort and then...
|
|
251
251
|
let entries: Array<[CalcitTag, CalcitValue]> = [];
|
|
@@ -259,13 +259,13 @@ export let extract_cirru_edn = (x: CirruEdnFormat, options: CalcitValue): Calcit
|
|
|
259
259
|
if (typeof pair[0] === "string") {
|
|
260
260
|
entries.push([extractFieldTag(pair[0]), extract_cirru_edn(pair[1], options)]);
|
|
261
261
|
} else {
|
|
262
|
-
throw new Error(
|
|
262
|
+
throw new Error(`Expected string as field, got: ${pair}`);
|
|
263
263
|
}
|
|
264
264
|
} else {
|
|
265
|
-
throw new Error(
|
|
265
|
+
throw new Error(`Expected pair of size 2, got: ${pair}`);
|
|
266
266
|
}
|
|
267
267
|
} else {
|
|
268
|
-
throw new Error(
|
|
268
|
+
throw new Error(`Expected pairs for reocrd, got: ${pair}`);
|
|
269
269
|
}
|
|
270
270
|
});
|
|
271
271
|
entries.sort((a, b) => {
|
|
@@ -318,13 +318,13 @@ export let extract_cirru_edn = (x: CirruEdnFormat, options: CalcitValue): Calcit
|
|
|
318
318
|
}
|
|
319
319
|
if (x[0] === "quote") {
|
|
320
320
|
if (x.length !== 2) {
|
|
321
|
-
throw new Error(
|
|
321
|
+
throw new Error(`quote expects 1 argument, got: ${x}`);
|
|
322
322
|
}
|
|
323
323
|
return new CalcitCirruQuote(x[1]);
|
|
324
324
|
}
|
|
325
325
|
if (x[0] === "::") {
|
|
326
326
|
if (x.length < 2) {
|
|
327
|
-
throw new Error(
|
|
327
|
+
throw new Error(`tuple expects at least 1 value, got: ${x}`);
|
|
328
328
|
}
|
|
329
329
|
return new CalcitTuple(
|
|
330
330
|
extract_cirru_edn(x[1], options),
|
|
@@ -337,7 +337,7 @@ export let extract_cirru_edn = (x: CirruEdnFormat, options: CalcitValue): Calcit
|
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
339
|
console.error(x);
|
|
340
|
-
throw new Error(
|
|
340
|
+
throw new Error(`Unexpected data from EDN: ${x}`);
|
|
341
341
|
};
|
|
342
342
|
|
|
343
343
|
export let format_cirru_edn = (data: CalcitValue, useInline: boolean = true): string => {
|