From f13c96b5a24236eef5a8dfb42990d47976f5249f Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Tue, 22 Nov 2016 23:35:56 -0600 Subject: [PATCH] Pass fn to proxy method --- lib/workflow.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/workflow.js b/lib/workflow.js index 49930612..876f6bf6 100644 --- a/lib/workflow.js +++ b/lib/workflow.js @@ -17,7 +17,7 @@ module.exports = class Workflow { if (method !== 'constructor') { // Define a new function in the API for this plugin method, forcing // the binding to this to prevent any tampering. - this.api[method] = this.proxy(plugin, method).bind(this); + this.api[method] = this.proxy(plugin[method]).bind(this); } } } @@ -37,10 +37,10 @@ module.exports = class Workflow { }) && this.filterFn(event); } - proxy(plugin, method) { + proxy(fn) { return (...args) => { // Push new function on the stack that calls the plugin method with a context. - this.stack.push(context => plugin[method](context, ...args)); + this.stack.push(context => fn(context, ...args)); // Return the API to allow methods to be chained. return this.api;