mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-04-25 22:46:31 -04:00
14 lines
343 B
TypeScript
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;
|