Skip to content

Commit

Permalink
fix: pick, set truthy only (#18) skip-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
2nthony authored Jul 14, 2022
1 parent 60dc22a commit 187daab
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/helpers/pick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ export function pick<T extends object, K extends keyof T>(
keys: K[],
): Pick<T, K> {
return keys.reduce((val, k) => {
val[k] = obj[k]
if (obj[k]) {
val[k] = obj[k]
}
return val
}, {} as T)
}

0 comments on commit 187daab

Please sign in to comment.