UNPKG

vue-styleguidist

Version:
23 lines (22 loc) 818 B
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray"; import "core-js/modules/es.array.reduce.js"; import "core-js/modules/es.object.to-string.js"; import "core-js/modules/es.array.concat.js"; /** * Get all components in all sections * * @param {array} sections */ export default function getComponentsFromSections(sections) { return sections.reduce(function (allComponent, section) { var sectionComponents = []; var subSectionComponents = []; if (section.components) { sectionComponents = section.components; } if (section.sections) { subSectionComponents = getComponentsFromSections(section.sections); } return [].concat(_toConsumableArray(allComponent), _toConsumableArray(sectionComponents), _toConsumableArray(subSectionComponents)); }, []); }