Continued updating the code to work with entities better
This commit is contained in:
@@ -44,7 +44,7 @@ export const convertBase64 = (file: File) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const mapBy = <T>(obj: T[] | undefined, key: keyof T) => (obj || []).map((i) => i[key]);
|
||||
export const mapBy = <T, K extends keyof T>(obj: T[] | undefined, key: K) => (obj || []).map((i) => i[key] as T[K]);
|
||||
export const filterBy = <T>(obj: T[], key: keyof T, value: any) => obj.filter((i) => i[key] === value);
|
||||
|
||||
export const serialize = <T>(obj: T): T => JSON.parse(JSON.stringify(obj));
|
||||
|
||||
Reference in New Issue
Block a user