fix: ensafen invokePlugin

This commit is contained in:
cha0s 2020-12-03 23:53:21 -06:00
parent 3c8cf9b4f0
commit 0286f02dad

View File

@ -103,9 +103,12 @@ export default class Plugins {
if (!this.hooks[hook]) { if (!this.hooks[hook]) {
return undefined; return undefined;
} }
return this.hooks[hook] const candidate = this.hooks[hook]
.find(({plugin: candidate}) => candidate === plugin) .find(({plugin: candidate}) => candidate === plugin);
.fn(...(args.concat(this))); if (!candidate) {
return undefined;
}
return candidate.fn(...(args.concat(this)));
} }
invokeReduce(hook, initial = {}, reducer = (r, o) => ({...r, ...o}), ...args) { invokeReduce(hook, initial = {}, reducer = (r, o) => ({...r, ...o}), ...args) {