Allow plugins:["*"] (#229)

This commit is contained in:
Daniel Tschinder
2016-11-18 01:04:58 +01:00
committed by Henry Zhu
parent 03352cb480
commit 6d3b63454c
4 changed files with 302 additions and 1 deletions

View File

@@ -37,7 +37,24 @@ export default class Parser extends Tokenizer {
this[name] = f(this[name]);
}
loadPlugins(pluginList: Array<string>): Object {
loadAllPlugins() {
// ensure flow plugin loads last
const pluginNames = Object.keys(plugins).filter((name) => name !== "flow");
pluginNames.push("flow");
pluginNames.forEach((name) => {
let plugin = plugins[name];
if (plugin) plugin(this);
});
}
loadPlugins(pluginList: Array<string>): { [key: string]: boolean } {
if (pluginList.indexOf("*") >= 0) {
this.loadAllPlugins();
return { "*": true };
}
let pluginMap = {};
if (pluginList.indexOf("flow") >= 0) {