promise-pool-ext
Advanced tools
Comparing version 3.2.0 to 3.3.0
@@ -6,7 +6,10 @@ import assert from 'assert'; | ||
export default (logic, opts) => { | ||
Joi.assert(logic, Joi.object().min(1).pattern( | ||
export default (logic_, opts) => { | ||
Joi.assert(logic_, Joi.object().min(1).pattern( | ||
Joi.string(), | ||
Joi.object().keys({ | ||
requires: Joi.array().items(Joi.string().valid(...Object.keys(logic))).optional(), | ||
requires: Joi.alternatives( | ||
Joi.array().items(Joi.string().valid(...Object.keys(logic_))), | ||
Joi.string().valid('*') | ||
).optional(), | ||
if: Joi.function().optional(), | ||
@@ -16,2 +19,10 @@ fn: Joi.function() | ||
)); | ||
const logic = Object.fromEntries( | ||
Object | ||
.entries(logic_) | ||
.map(([k, v], idx, arr) => [k, v.requires === '*' ? { | ||
...v, | ||
requires: arr.slice(0, idx).map((e) => e[0]) | ||
} : v]) | ||
); | ||
checkCyclic(Object.entries(logic) | ||
@@ -18,0 +29,0 @@ .reduce((p, [k, v]) => Object.assign(p, { [k]: v.requires || [] }), {})); |
{ | ||
"name": "promise-pool-ext", | ||
"type": "module", | ||
"version": "3.2.0", | ||
"version": "3.3.0", | ||
"main": "lib/index.js", | ||
@@ -6,0 +6,0 @@ "repository": { |
@@ -71,2 +71,4 @@ # promise-pool-ext | ||
The `requires` option can be set to `"*"` to make all previous tasks required. | ||
See tests for more examples | ||
@@ -73,0 +75,0 @@ |
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
13886
236
120