Skip to content

Commit

Permalink
Add getCustomComponentByType
Browse files Browse the repository at this point in the history
Signed-off-by: Zvonimir Fras <[email protected]>
  • Loading branch information
zvonimirfras committed Nov 3, 2023
1 parent f45b34c commit 55a2984
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/sdk/src/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ export const getUsedCollectionsAngularDependencies = (collections: any[], compon
return getUsedCollectionsValuesByProp(collections, componentObj, 'angular.dependencies');
};

export const getCustomComponentByType = (componentType: string, collections: any[]) => {
const allComponents = collections.flatMap((collection: any) => collection.components || []);

return allComponents.find((component: any) => component.type === componentType);
};

const updatedList = (list: any[], item: any, dropInIndex?: number) => {
if (dropInIndex === undefined) {
return [...list, item];
Expand Down

0 comments on commit 55a2984

Please sign in to comment.