@data-prism/utils
Advanced tools
+1
-0
| export declare function applyOrMap(itemItemsOrNull: any, fn: any): any; | ||
| export declare function applyOrMapAsync(itemItemsOrNull: any, asyncFn: any): any; | ||
| export declare function pipeThru(init: any, fns: any): any; | ||
| //# sourceMappingURL=utils.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,CAAC,eAAe,KAAA,EAAE,EAAE,KAAA,OAI7C;AAED,wBAAgB,QAAQ,CAAC,IAAI,KAAA,EAAE,GAAG,KAAA,OAKjC"} | ||
| {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,CAAC,eAAe,KAAA,EAAE,EAAE,KAAA,OAI7C;AAED,wBAAgB,eAAe,CAAC,eAAe,KAAA,EAAE,OAAO,KAAA,OAMvD;AAED,wBAAgB,QAAQ,CAAC,IAAI,KAAA,EAAE,GAAG,KAAA,OAKjC"} |
+7
-0
@@ -7,4 +7,11 @@ // export { tabularize } from "./tree.js"; | ||
| } | ||
| export function applyOrMapAsync(itemItemsOrNull, asyncFn) { | ||
| if (itemItemsOrNull) | ||
| return itemItemsOrNull; | ||
| return Array.isArray(itemItemsOrNull) | ||
| ? Promise.all(itemItemsOrNull.map(asyncFn)) | ||
| : asyncFn(itemItemsOrNull); | ||
| } | ||
| export function pipeThru(init, fns) { | ||
| return fns.reduce((onion, fn) => (val) => fn(onion(val)), (val) => val)(init); | ||
| } |
+1
-1
| { | ||
| "name": "@data-prism/utils", | ||
| "version": "0.0.3", | ||
| "version": "0.0.4", | ||
| "type": "module", | ||
@@ -5,0 +5,0 @@ "main": "./src/utils.js", |
+8
-0
@@ -9,2 +9,10 @@ // export { tabularize } from "./tree.js"; | ||
| export function applyOrMapAsync(itemItemsOrNull, asyncFn) { | ||
| if (itemItemsOrNull) return itemItemsOrNull; | ||
| return Array.isArray(itemItemsOrNull) | ||
| ? Promise.all(itemItemsOrNull.map(asyncFn)) | ||
| : asyncFn(itemItemsOrNull); | ||
| } | ||
| export function pipeThru(init, fns) { | ||
@@ -11,0 +19,0 @@ return fns.reduce( |
Sorry, the diff of this file is not supported yet
79800
0.77%133
11.76%