From 396687b133f98ef532f51a10ca1f1514d7b0a5dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=84=A0=EB=AF=BC?= Date: Fri, 29 Mar 2024 00:39:39 +0900 Subject: [PATCH] Refactor: emptyObject function in patterns.ts --- src/patterns.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/patterns.ts b/src/patterns.ts index 021440b8..ebca0ea0 100644 --- a/src/patterns.ts +++ b/src/patterns.ts @@ -1128,7 +1128,6 @@ export function shape(pattern: UnknownPattern) { * .with(P.object.empty(), () => 'will match on empty objects') */ const emptyObject = (): GuardExcludeP => when( - // (value) => value && typeof value === 'object' && Object.keys(value).length === 0, (value) => { if (!isObject(value)) return false; @@ -1141,7 +1140,7 @@ const objectChainable = >( pattern: pattern ): ObjectChainable => Object.assign(chainable(pattern), { - empty: emptyObject, + empty: () => chainable(intersection(pattern, emptyObject())), }) as any; /**