Simplify getItemsByEntityClass

Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
Panu Horsmalahti committed 2022-01-18 14:51:26 +02:00
1 parent 1ee5e32738
commit 4919d358aa
1 file changed
+1 -5
+1 -5
View File
@@ -43,12 +43,8 @@ export class CatalogEntityRegistry {
return this.items.filter((item) => item.apiVersion === apiVersion && item.kind === kind) as T[];
}
getItemsOfType<T extends CatalogEntity>(Constructor: CatalogEntityConstructor<T>): T[] {
return this.items.filter((item) => item instanceof Constructor) as T[];
}
getItemsByEntityClass<T extends CatalogEntity>(constructor: CatalogEntityConstructor<T>): T[] {
return this.getItemsOfType(constructor);
return this.items.filter((item) => item instanceof constructor) as T[];
}
}