From 510e16e90abc2b2968f284be52b0aa10e6903783 Mon Sep 17 00:00:00 2001 From: Jon Ambas Date: Sat, 6 Apr 2024 13:01:36 -0400 Subject: [PATCH] refactor: reuse isObject in isObjectWithValue (#11) --- src/utils.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index 2aa9fa6..39b245c 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,12 +1,7 @@ -export const isObject = (value: any) => { - return typeof value === 'object' && value != null && !Array.isArray(value); +export const isObject = (obj: any) => { + return typeof obj === 'object' && obj != null && !Array.isArray(obj); }; export const isObjectWithValue = (obj: any) => { - return ( - typeof obj === 'object' && - obj != null && - !Array.isArray(obj) && - 'value' in obj - ); + return isObject(obj) && 'value' in obj; };