@calcit/procs 0.9.9 → 0.9.11

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/README.md CHANGED
@@ -100,7 +100,7 @@ Read more in [Respo Calcit Workflow](https://github.com/calcit-lang/respo-calcit
100
100
 
101
101
  ```cirru
102
102
  {}
103
- :calcit-version |0.9.9
103
+ :calcit-version |0.9.11
104
104
  :dependencies $ {}
105
105
  |calcit-lang/memof |0.0.11
106
106
  |calcit-lang/lilac |main
@@ -1170,6 +1170,17 @@ export let transform_code_to_cirru = (x) => {
1170
1170
  export let js_array = (...xs) => {
1171
1171
  return xs;
1172
1172
  };
1173
+ /** for..await alternative with function */
1174
+ export let js_for_await = async (stream, f) => {
1175
+ if (typeof f !== "function") {
1176
+ throw new Error(`Expected function for: ${f}`);
1177
+ }
1178
+ let ret = null;
1179
+ for await (let item of stream) {
1180
+ ret = await f(item);
1181
+ }
1182
+ return ret;
1183
+ };
1173
1184
  export let _$n_js_object = (...xs) => {
1174
1185
  if (xs.length % 2 !== 0) {
1175
1186
  throw new Error("&js-object expects even number of arguments");
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calcit/procs",
3
- "version": "0.9.9",
3
+ "version": "0.9.11",
4
4
  "main": "./lib/calcit.procs.mjs",
5
5
  "devDependencies": {
6
6
  "@types/node": "^22.10.7",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calcit/procs",
3
- "version": "0.9.9",
3
+ "version": "0.9.11",
4
4
  "main": "./lib/calcit.procs.mjs",
5
5
  "devDependencies": {
6
6
  "@types/node": "^22.10.7",
@@ -1255,6 +1255,18 @@ export let js_array = (...xs: CalcitValue[]): CalcitValue[] => {
1255
1255
  return xs;
1256
1256
  };
1257
1257
 
1258
+ /** for..await alternative with function */
1259
+ export let js_for_await = async (stream: AsyncIterableIterator<CalcitValue>, f: (v: CalcitValue) => Promise<CalcitValue>) => {
1260
+ if (typeof f !== "function") {
1261
+ throw new Error(`Expected function for: ${f}`);
1262
+ }
1263
+ let ret = null;
1264
+ for await (let item of stream) {
1265
+ ret = await f(item);
1266
+ }
1267
+ return ret
1268
+ }
1269
+
1258
1270
  export let _$n_js_object = (...xs: CalcitValue[]): Record<string, CalcitValue> => {
1259
1271
  if (xs.length % 2 !== 0) {
1260
1272
  throw new Error("&js-object expects even number of arguments");