diff --git a/source/index.ts b/source/index.ts index 4a3df85..3e68b19 100644 --- a/source/index.ts +++ b/source/index.ts @@ -286,14 +286,14 @@ is.safeInteger = (value: unknown): value is number => Number.isSafeInteger(value is.plainObject = (value: unknown): value is Record => { // From: https://github.com/sindresorhus/is-plain-obj/blob/main/index.js - if (toString.call(value) !== '[object Object]') { + if (typeof value !== 'object' || value === null) { return false; } // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const prototype = Object.getPrototypeOf(value); - return prototype === null || prototype === Object.getPrototypeOf({}); + return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value); }; is.typedArray = (value: unknown): value is TypedArray => isTypedArrayName(getObjectType(value));