File size: 727 Bytes
2434dca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function pluginsFrom(plugins) {
  var flatPlugins = {
    level1Value: [],
    level1Property: [],
    level2Block: []
  };

  plugins = plugins || [];

  flatPlugins.level1Value = plugins
    .map(function(plugin) { return plugin.level1 && plugin.level1.value; })
    .filter(function(plugin) { return plugin != null; });

  flatPlugins.level1Property = plugins
    .map(function(plugin) { return plugin.level1 && plugin.level1.property; })
    .filter(function(plugin) { return plugin != null; });

  flatPlugins.level2Block = plugins
    .map(function(plugin) { return plugin.level2 && plugin.level2.block; })
    .filter(function(plugin) { return plugin != null; });

  return flatPlugins;
}

module.exports = pluginsFrom;