refactor: remove invokeParallel

This commit is contained in:
cha0s 2022-03-08 14:42:34 -06:00
parent 83c600db2a
commit 46a52b5d28
3 changed files with 4 additions and 22 deletions

View File

@ -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()`.

View File

@ -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;

View File

@ -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});