plugins.js 727 B

12345678910111213141516171819202122232425
  1. function pluginsFrom(plugins) {
  2. var flatPlugins = {
  3. level1Value: [],
  4. level1Property: [],
  5. level2Block: []
  6. };
  7. plugins = plugins || [];
  8. flatPlugins.level1Value = plugins
  9. .map(function(plugin) { return plugin.level1 && plugin.level1.value; })
  10. .filter(function(plugin) { return plugin != null; });
  11. flatPlugins.level1Property = plugins
  12. .map(function(plugin) { return plugin.level1 && plugin.level1.property; })
  13. .filter(function(plugin) { return plugin != null; });
  14. flatPlugins.level2Block = plugins
  15. .map(function(plugin) { return plugin.level2 && plugin.level2.block; })
  16. .filter(function(plugin) { return plugin != null; });
  17. return flatPlugins;
  18. }
  19. module.exports = pluginsFrom;