From 2367b5a37d1d5206d744518b45a198489cbb46fe Mon Sep 17 00:00:00 2001 From: Alec Larson <1925840+aleclarson@users.noreply.github.com> Date: Sun, 7 Jul 2024 23:07:50 -0400 Subject: [PATCH] fix null check --- src/array/toggle.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/array/toggle.ts b/src/array/toggle.ts index a4af8256..f7481936 100644 --- a/src/array/toggle.ts +++ b/src/array/toggle.ts @@ -30,14 +30,8 @@ export function toggle( strategy?: 'prepend' | 'append' }, ): T[] { - if (!array && !item) { - return [] - } if (!array) { - return [item] - } - if (!item) { - return [...array] + return item !== undefined ? [item] : [] } const matcher = toKey