Skip to content

Commit

Permalink
fix null check
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson committed Jul 8, 2024
1 parent c52bf6f commit 2367b5a
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/array/toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,8 @@ export function toggle<T>(
strategy?: 'prepend' | 'append'
},
): T[] {
if (!array && !item) {
return []
}
if (!array) {
return [item]
}
if (!item) {
return [...array]
return item !== undefined ? [item] : []
}

const matcher = toKey
Expand Down

0 comments on commit 2367b5a

Please sign in to comment.