refactor; flatten property list
This commit is contained in:
parent
4c1adf258b
commit
f00fa1c4aa
|
@ -10,16 +10,10 @@ class Compiler {
|
||||||
compile_contracts(contractFiles, cb) {
|
compile_contracts(contractFiles, cb) {
|
||||||
let available_compilers = {};
|
let available_compilers = {};
|
||||||
|
|
||||||
if (this.plugins) {
|
let pluginCompilers = this.plugins.getPluginsProperty('compilers', 'compilers');
|
||||||
let compilerPlugins = this.plugins.getPluginsFor('compilers');
|
pluginCompilers.forEach(function (compilerObject) {
|
||||||
if (compilerPlugins.length > 0) {
|
available_compilers[compilerObject.extension] = compilerObject.cb;
|
||||||
compilerPlugins.forEach(function (plugin) {
|
});
|
||||||
plugin.compilers.forEach(function (compilerObject) {
|
|
||||||
available_compilers[compilerObject.extension] = compilerObject.cb;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let compiledObject = {};
|
let compiledObject = {};
|
||||||
|
|
||||||
|
|
|
@ -56,9 +56,13 @@ Plugins.prototype.getPluginsProperty = function(pluginType, property) {
|
||||||
return plugin.has(pluginType);
|
return plugin.has(pluginType);
|
||||||
});
|
});
|
||||||
|
|
||||||
return matchingPlugins.map((plugin) => {
|
let matchingProperties = matchingPlugins.map((plugin) => {
|
||||||
return plugin[property];
|
return plugin[property];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//return flattened list
|
||||||
|
if (matchingProperties.length === 0) return [];
|
||||||
|
return matchingProperties.reduce((a,b) => { return a.concat(b); })
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = Plugins;
|
module.exports = Plugins;
|
||||||
|
|
Loading…
Reference in New Issue