Skip to content

Commit

Permalink
fix(useToggle): toggle function return value (vitest-dev#1256)
Browse files Browse the repository at this point in the history
  • Loading branch information
webfansplz committed Feb 13, 2022
1 parent dcb0cda commit 8d190ae
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/shared/useToggle/index.ts
Expand Up @@ -16,6 +16,7 @@ export function useToggle(initialValue: boolean | Ref<boolean> = false) {
initialValue.value = typeof value === 'boolean'
? value
: !initialValue.value
return initialValue.value
}
}
else {
Expand All @@ -24,6 +25,7 @@ export function useToggle(initialValue: boolean | Ref<boolean> = false) {
boolean.value = typeof value === 'boolean'
? value
: !boolean.value
return boolean.value
}

return [boolean, toggle] as const
Expand Down

0 comments on commit 8d190ae

Please sign in to comment.