Skip to content

Commit

Permalink
Update src/utils/compact.ts
Browse files Browse the repository at this point in the history
Co-authored-by: Ethan Smith <[email protected]>
  • Loading branch information
crgwbr and onebytegone authored Sep 3, 2024
1 parent 6aeef2c commit 0674954
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/utils/compact.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
type FalseyVals = '' | 0 | false | null | undefined;

const notFalsey = <T>(
value: T | FalseyVals
): value is T => {
return (
value !== '' &&
value !== 0 &&
value !== false &&
value !== null &&
value !== undefined
);
function notFalsy<T>(value: T | FalsyVals): value is T {
return value !== ''
&& value !== 0
&& value !== false
&& value !== null
&& value !== undefined;
};

export function compact<T>(arr: (T | FalseyVals)[]): T[] {
Expand Down

0 comments on commit 0674954

Please sign in to comment.