shoelace/scripts/shared.js

20 wiersze
472 B
JavaScript
Czysty Zwykły widok Historia

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