mirror of
https://github.com/hanzoai/calendar.git
synced 2026-09-24 22:42:24 +00:00
Co-authored-by: Alex van Andel <[email protected]> Co-authored-by: Morgan <[email protected]> Co-authored-by: Morgan Vernay <[email protected]> Co-authored-by: Omar López <[email protected]>
7 lines
311 B
TypeScript
7 lines
311 B
TypeScript
export const notUndefined = <T>(val: T | undefined): val is T => Boolean(val);
|
|
export const uniqueBy = <T extends { [key: string]: unknown }>(array: T[], keys: (keyof T)[]) => {
|
|
return array.filter(
|
|
(item, index, self) => index === self.findIndex((t) => keys.every((key) => t[key] === item[key]))
|
|
);
|
|
};
|