refactor: remove invokeParallel
This commit is contained in:
parent
83c600db2a
commit
46a52b5d28
4
TODO.md
4
TODO.md
|
@ -19,3 +19,7 @@
|
|||
- [ ] renamed to 'build/config'?
|
||||
- [ ] automatically generated list of build config
|
||||
- [ ] static documentation site generator
|
||||
- [ ] autogenerated config dox page
|
||||
- [x] remove `invokeParallel()`
|
||||
- [ ] Specialize `invokeReduce()` with `invokeMerge()`.
|
||||
- [ ] Rename all hooks to dot-first notation; rewrite `lookupFlecks()`.
|
|
@ -261,21 +261,6 @@ export default class Flecks {
|
|||
return candidate.fn(...(args.concat(this)));
|
||||
}
|
||||
|
||||
invokeParallel(hook, ...args) {
|
||||
if (!this.hooks[hook]) {
|
||||
return [];
|
||||
}
|
||||
const flecks = this.flecksImplementing(hook);
|
||||
if (0 === flecks.length) {
|
||||
return [];
|
||||
}
|
||||
const results = [];
|
||||
for (let i = 0; i < flecks.length; ++i) {
|
||||
results.push(this.invokeFleck(hook, flecks[i], ...(args.concat(this))));
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
invokeReduce(hook, initial = {}, reducer = (r, o) => ({...r, ...o}), ...args) {
|
||||
if (!this.hooks[hook]) {
|
||||
return initial;
|
||||
|
|
|
@ -25,13 +25,6 @@ it('can invoke', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('can invoke parallel', async () => {
|
||||
const O = {foo: 3};
|
||||
await Promise.all(flecks.invokeParallel('@flecks/core/test/invoke-parallel', O));
|
||||
expect(O.foo)
|
||||
.to.equal(8);
|
||||
});
|
||||
|
||||
it('can invoke reduced', () => {
|
||||
expect(flecks.invokeReduce('@flecks/core/test/invoke-reduce'))
|
||||
.to.deep.equal({foo: 69, bar: 420});
|
||||
|
|
Loading…
Reference in New Issue
Block a user