Skip to content

Commit

Permalink
refactor: reuse isObject in isObjectWithValue (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonambas authored Apr 6, 2024
1 parent 3c21845 commit 510e16e
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -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;
};

0 comments on commit 510e16e

Please sign in to comment.