1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-25 22:46:31 -04:00
Files
Sonarr/frontend/src/Utilities/Object/selectUniqueIds.ts
T
2024-07-28 16:59:48 -07:00

14 lines
343 B
TypeScript

import KeysMatching from 'typings/Helpers/KeysMatching';
function selectUniqueIds<T, K>(items: T[], idProp: KeysMatching<T, K>) {
return items.reduce((acc: K[], item) => {
if (item[idProp] && acc.indexOf(item[idProp] as K) === -1) {
acc.push(item[idProp] as K);
}
return acc;
}, []);
}
export default selectUniqueIds;