Files
webawesome/scripts/shared.js

20 lines
472 B
JavaScript
Raw Permalink Normal View History

2022-12-06 11:48:57 -05:00
/** Gets an array of components from a CEM object. */
2021-09-09 09:13:55 -04:00
export function getAllComponents(metadata) {
const allComponents = [];
metadata.modules.map(module => {
module.declarations?.map(declaration => {
if (declaration.customElement) {
const component = declaration;
2022-11-10 16:27:23 -05:00
const path = module.path;
2021-09-09 09:13:55 -04:00
if (component) {
2022-11-10 16:27:23 -05:00
allComponents.push(Object.assign(component, { path }));
2021-09-09 09:13:55 -04:00
}
}
});
});
return allComponents;
}