@calcit/procs 0.7.14 → 0.8.0-a2
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/calcit.procs.mjs +1 -1
- package/lib/js-cirru.mjs +14 -0
- package/package.json +1 -1
- package/ts-src/calcit.procs.mts +1 -1
- package/ts-src/js-cirru.mts +13 -1
package/lib/calcit.procs.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _a;
|
|
2
2
|
// CALCIT VERSION
|
|
3
|
-
export const calcit_version = "0.
|
|
3
|
+
export const calcit_version = "0.8.0-a2";
|
|
4
4
|
import { parse } from "@cirru/parser.ts";
|
|
5
5
|
import { writeCirruCode } from "@cirru/writer.ts";
|
|
6
6
|
import { CalcitSymbol, CalcitTag, CalcitRef, CalcitRecur, newTag, refsRegistry, toString, getStringName, _$n__$e_, hashFunction, } from "./calcit-data.mjs";
|
package/lib/js-cirru.mjs
CHANGED
|
@@ -109,6 +109,20 @@ export let to_cirru_edn = (x) => {
|
|
|
109
109
|
for (let idx = 0; idx < x.fields.length; idx++) {
|
|
110
110
|
buffer.push([x.fields[idx].toString(), to_cirru_edn(x.values[idx])]);
|
|
111
111
|
}
|
|
112
|
+
// placed literals first
|
|
113
|
+
buffer.sort((a, b) => {
|
|
114
|
+
let a1_literal = is_literal(a[1]);
|
|
115
|
+
let b1_literal = is_literal(b[1]);
|
|
116
|
+
if (a1_literal && !b1_literal) {
|
|
117
|
+
return -1;
|
|
118
|
+
}
|
|
119
|
+
else if (!a1_literal && b1_literal) {
|
|
120
|
+
return 1;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
return _$n_compare(a[0], b[0]);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
112
126
|
return buffer;
|
|
113
127
|
}
|
|
114
128
|
if (x instanceof CalcitSet) {
|
package/package.json
CHANGED
package/ts-src/calcit.procs.mts
CHANGED
package/ts-src/js-cirru.mts
CHANGED
|
@@ -108,10 +108,22 @@ export let to_cirru_edn = (x: CalcitValue): CirruEdnFormat => {
|
|
|
108
108
|
return buffer;
|
|
109
109
|
}
|
|
110
110
|
if (x instanceof CalcitRecord) {
|
|
111
|
-
let buffer: CirruEdnFormat = ["%{}", x.name.toString()];
|
|
111
|
+
let buffer: [string, CirruEdnFormat] = ["%{}", x.name.toString()];
|
|
112
112
|
for (let idx = 0; idx < x.fields.length; idx++) {
|
|
113
113
|
buffer.push([x.fields[idx].toString(), to_cirru_edn(x.values[idx])]);
|
|
114
114
|
}
|
|
115
|
+
// placed literals first
|
|
116
|
+
buffer.sort((a, b) => {
|
|
117
|
+
let a1_literal = is_literal(a[1] as CalcitValue);
|
|
118
|
+
let b1_literal = is_literal(b[1] as CalcitValue);
|
|
119
|
+
if (a1_literal && !b1_literal) {
|
|
120
|
+
return -1;
|
|
121
|
+
} else if (!a1_literal && b1_literal) {
|
|
122
|
+
return 1;
|
|
123
|
+
} else {
|
|
124
|
+
return _$n_compare(a[0] as CalcitValue, b[0] as CalcitValue);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
115
127
|
return buffer;
|
|
116
128
|
}
|
|
117
129
|
if (x instanceof CalcitSet) {
|