12 lines
257 B
TypeScript
12 lines
257 B
TypeScript
|
const getFilled = <T>(
|
||
|
array: T[],
|
||
|
{ isReverse = false }: { isReverse?: boolean } = {},
|
||
|
): T[] =>
|
||
|
array.filter(
|
||
|
isReverse
|
||
|
? (element: T) => element === undefined
|
||
|
: (element: T) => element !== undefined,
|
||
|
);
|
||
|
|
||
|
export default getFilled;
|