Skip to content

Commit

Permalink
fix(utilities): Enhanced the logic in the isObject utility function
Browse files Browse the repository at this point in the history
  • Loading branch information
sullivanpj committed Dec 25, 2023
1 parent 567d1bf commit 0e27903
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/utilities/src/type-checks/is-object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import { isPlainObject } from "./is-plain-object";
*/
export const isObject = (value: unknown): value is object => {
try {
return (!!value && value.constructor === Object) || isPlainObject(value);
return (
typeof value === "object" ||
(!!value && value.constructor === Object) ||
isPlainObject(value)
);
} catch (e) {
return false;
}
Expand Down

0 comments on commit 0e27903

Please sign in to comment.