Skip to content

Commit

Permalink
refactor: processing call plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
Scrum committed Feb 8, 2018
1 parent 62f0d5e commit 260750c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@ export default (...options) => {
console.log('\n');
}

return plugins.reduce((ctx, plugin) => {
ctx = plugin(ctx, typeof res === 'function' ? res() : res) || ctx;
if (processor.plugins) {
processor.plugins.push(...plugins);
}

if (!processor.plugins) {
plugins.forEach(plugin => tree = plugin(ctx))
}

return ctx;
}, ctx);
return typeof res === 'function' ? res(null, ctx) : ctx;
};
};

0 comments on commit 260750c

Please sign in to comment.