@randajan/jet-core
Advanced tools
Comparing version 4.0.8 to 4.0.9
@@ -59,14 +59,16 @@ import { | ||
}; | ||
var _eachParalel = async (parent, exe, options, prom) => { | ||
var _eachParalel = async (parent, exe, options, stopProm) => { | ||
const entries = parent.def.entries(parent.value); | ||
const refined = !parent.isRoot ? entries : await _refine(entries, options); | ||
await Promise.race([ | ||
Promise.all(refined.map(async ([key, val]) => { | ||
const ctx = createContext(parent, key, val); | ||
if (ctx.pending) { | ||
await exe(ctx); | ||
} | ||
})), | ||
prom | ||
]); | ||
const result = Promise.all(refined.map(async ([key, val]) => { | ||
const ctx = createContext(parent, key, val); | ||
if (ctx.pending) { | ||
await exe(ctx); | ||
} | ||
})); | ||
if (!stopProm) { | ||
await result; | ||
} else { | ||
await Promise.race([result, stopProm]); | ||
} | ||
}; | ||
@@ -81,3 +83,3 @@ var each = (any, fce, options = {}) => { | ||
const _each = !options.paralelAwait ? _eachSerial : _eachParalel; | ||
const prom = !options.paralelAwait || !options.stopable ? void 0 : new Promise((res) => { | ||
const stopProm = !options.paralelAwait || !options.stopable ? void 0 : new Promise((res) => { | ||
root.onStop(res); | ||
@@ -94,3 +96,3 @@ }); | ||
} else { | ||
await _each(ctx, exe, options, prom); | ||
await _each(ctx, exe, options, stopProm); | ||
} | ||
@@ -97,0 +99,0 @@ return ctx.result; |
{ | ||
"name": "@randajan/jet-core", | ||
"version": "4.0.8", | ||
"version": "4.0.9", | ||
"description": "Ecosystem of types and related usefull tools.", | ||
@@ -5,0 +5,0 @@ "repository": "randajan/jet-core", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
319906
3487