diff --git a/src/_utils.ts b/src/_utils.ts index 52ac3ed..fd9f2f3 100644 --- a/src/_utils.ts +++ b/src/_utils.ts @@ -1,16 +1,22 @@ -// From sindresorhus/is-plain-obj -// MIT License +// Forked from sindresorhus/is-plain-obj (MIT) // Copyright (c) Sindre Sorhus (https://sindresorhus.com) export function isPlainObject(value: unknown): boolean { if (value === null || typeof value !== "object") { return false; } const prototype = Object.getPrototypeOf(value); - return ( - (prototype === null || - prototype === Object.prototype || - Object.getPrototypeOf(prototype) === null) && - !(Symbol.toStringTag in value) && - !(Symbol.iterator in value) - ); + + if ( + prototype !== null && + prototype !== Object.prototype && + Object.getPrototypeOf(prototype) !== null + ) { + return false; + } + + if (Symbol.toStringTag in value || Symbol.iterator in value) { + return false; + } + + return true; }