anvil/striker-ui/lib/getFilled.ts

12 lines
257 B
TypeScript
Raw Normal View History

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