mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Simplify getItemsByEntityClass
Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
parent
1ee5e32738
commit
4919d358aa
@ -43,12 +43,8 @@ export class CatalogEntityRegistry {
|
|||||||
return this.items.filter((item) => item.apiVersion === apiVersion && item.kind === kind) as T[];
|
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[] {
|
getItemsByEntityClass<T extends CatalogEntity>(constructor: CatalogEntityConstructor<T>): T[] {
|
||||||
return this.getItemsOfType(constructor);
|
return this.items.filter((item) => item instanceof constructor) as T[];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user