|
@ -30,6 +30,10 @@ export function countUniques(source: T[], accessor: (item: T) => string): Rec |
|
|
return uniqueCounts; |
|
|
return uniqueCounts; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export function ensure<T>(source: T | T[] | undefined): T[] | undefined { |
|
|
|
|
|
return source == null ? undefined : Array.isArray(source) ? source : [source]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
export function filterMap<T, TMapped>( |
|
|
export function filterMap<T, TMapped>( |
|
|
source: T[], |
|
|
source: T[], |
|
|
predicateMapper: (item: T, index: number) => TMapped | null | undefined, |
|
|
predicateMapper: (item: T, index: number) => TMapped | null | undefined, |
|
|