@calcit/procs 0.29.0-alpha.26 → 0.29.0-alpha.27
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 +11 -2
- package/lib/js-cirru.d.mts +1 -1
- package/lib/js-cirru.mjs +9 -2
- package/lib/package.json +1 -1
- package/package.json +1 -1
package/lib/calcit.procs.mjs
CHANGED
|
@@ -930,12 +930,21 @@ export let add_watch_$x_ = (a, k, f) => {
|
|
|
930
930
|
if (!(typeof f === "function")) {
|
|
931
931
|
throw new Error("Expected watcher function");
|
|
932
932
|
}
|
|
933
|
+
for (const listenerKey of a.listeners.keys()) {
|
|
934
|
+
if (listenerKey instanceof CalcitTag && listenerKey.value === k.value) {
|
|
935
|
+
throw new Error(`add-watch! failed: listener with key \`${k.value}\` already existed`);
|
|
936
|
+
}
|
|
937
|
+
}
|
|
933
938
|
a.listeners.set(k, f);
|
|
934
939
|
};
|
|
935
940
|
export let remove_watch = (a, k) => {
|
|
936
|
-
|
|
937
|
-
|
|
941
|
+
for (const listenerKey of a.listeners.keys()) {
|
|
942
|
+
if (listenerKey instanceof CalcitTag && listenerKey.value === k.value) {
|
|
943
|
+
a.listeners.delete(listenerKey);
|
|
944
|
+
return;
|
|
945
|
+
}
|
|
938
946
|
}
|
|
947
|
+
throw new Error(`remove-watch failed: listener with key \`${k.value}\` not found`);
|
|
939
948
|
};
|
|
940
949
|
const MAX_RANGE_LENGTH = 4294967295;
|
|
941
950
|
export let range = (n, m, step = 1) => {
|
package/lib/js-cirru.d.mts
CHANGED
|
@@ -12,7 +12,7 @@ export declare class CalcitCirruQuote {
|
|
|
12
12
|
/** provide a simple text representation in Console or std out, with indentations */
|
|
13
13
|
textForm(): string;
|
|
14
14
|
}
|
|
15
|
-
export declare let format_cirru: (data: CalcitCirruQuote | CalcitList, useInline
|
|
15
|
+
export declare let format_cirru: (data: CalcitCirruQuote | CalcitList, useInline?: boolean) => string;
|
|
16
16
|
export declare let format_cirru_one_liner: (data: CalcitCirruQuote | CalcitList) => string;
|
|
17
17
|
/** better use string version of Cirru EDN in future */
|
|
18
18
|
export declare let to_cirru_edn: (x: CalcitValue) => CirruEdnFormat;
|
package/lib/js-cirru.mjs
CHANGED
|
@@ -160,7 +160,12 @@ export class CalcitCirruQuote {
|
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
-
export let format_cirru = (data, useInline)
|
|
163
|
+
export let format_cirru = function (data, useInline) {
|
|
164
|
+
if (arguments.length < 2)
|
|
165
|
+
useInline = false;
|
|
166
|
+
if (typeof useInline !== "boolean") {
|
|
167
|
+
throw new Error("format-cirru requires a boolean inline option");
|
|
168
|
+
}
|
|
164
169
|
if (data instanceof CalcitCirruQuote) {
|
|
165
170
|
return writeCirruCode(data.value, { useInline });
|
|
166
171
|
}
|
|
@@ -563,7 +568,9 @@ export let extract_cirru_edn = (x, options) => {
|
|
|
563
568
|
export let extract_cirru_edn_for_typed = (x, options) => {
|
|
564
569
|
return extract_cirru_edn_inner(x, options, true);
|
|
565
570
|
};
|
|
566
|
-
export let format_cirru_edn = (data, useInline
|
|
571
|
+
export let format_cirru_edn = function (data, useInline) {
|
|
572
|
+
if (arguments.length < 2)
|
|
573
|
+
useInline = true;
|
|
567
574
|
if (typeof useInline !== "boolean") {
|
|
568
575
|
throw new Error("format-cirru-edn requires a boolean inline option");
|
|
569
576
|
}
|
package/lib/package.json
CHANGED