@calcit/procs 0.29.0-alpha.13 → 0.29.0-alpha.15

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.
@@ -361,6 +361,7 @@ export declare function _$n_methods_of(obj: CalcitValue): CalcitSliceList;
361
361
  export declare function _$n_inspect_methods(obj: CalcitValue, note: CalcitValue): CalcitValue;
362
362
  /** Dispatch through one nominal origin; duplicate implementations never select by order. */
363
363
  export declare function _$n_trait_call(traitDef: CalcitValue, method: CalcitValue, obj: CalcitValue, ...args: CalcitValue[]): CalcitValue;
364
+ export declare let _$n_map_$o_fold_kv: (m: CalcitValue, initial: CalcitValue, reducer: CalcitFn) => CalcitValue;
364
365
  export declare let _$n_map_$o_to_list: (m: CalcitValue) => CalcitSliceList;
365
366
  export declare let _$n_map_$o_keys: (m: CalcitValue) => CalcitSet;
366
367
  export declare let _$n_map_$o_vals: (m: CalcitValue) => CalcitSliceList;
@@ -2808,6 +2808,19 @@ export function _$n_trait_call(traitDef, method, obj, ...args) {
2808
2808
  }
2809
2809
  throw new Error(`&trait-call: cannot find impl for trait ${traitDef.name.toString()} on ${toString(obj, true)}. Hint: use defimpl to create impls tagged by trait.`);
2810
2810
  }
2811
+ export let _$n_map_$o_fold_kv = (m, initial, reducer) => {
2812
+ if (!(m instanceof CalcitMap || m instanceof CalcitSliceMap)) {
2813
+ throw new Error("&map:fold-kv expected a Map");
2814
+ }
2815
+ if (typeof reducer !== "function") {
2816
+ throw new Error("&map:fold-kv expected a callback function");
2817
+ }
2818
+ let accumulator = initial;
2819
+ for (const [key, value] of m.pairs()) {
2820
+ accumulator = reducer(accumulator, key, value);
2821
+ }
2822
+ return accumulator;
2823
+ };
2811
2824
  export let _$n_map_$o_to_list = (m) => {
2812
2825
  if (m instanceof CalcitMap || m instanceof CalcitSliceMap) {
2813
2826
  let ys = [];
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calcit/procs",
3
- "version": "0.29.0-alpha.13",
3
+ "version": "0.29.0-alpha.15",
4
4
  "main": "./lib/calcit.procs.mjs",
5
5
  "files": [
6
6
  "lib/",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calcit/procs",
3
- "version": "0.29.0-alpha.13",
3
+ "version": "0.29.0-alpha.15",
4
4
  "main": "./lib/calcit.procs.mjs",
5
5
  "files": [
6
6
  "lib/",