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