Pacote
    Preparing search index...

    Function isPlainObject

    • Checks whether a value is a plain JavaScript object.

      Returns false for arrays, built-in objects, typed arrays, and primitive values. This function narrows the value to a string-keyed record.

      Parameters

      • o: unknown

        Value to check.

      Returns o is Record<string, unknown>

      true when the value is a plain object.

      import { isPlainObject } from '@pacote/is-plain-object'

      isPlainObject({ answer: 42 }) // => true
      isPlainObject({ an: 'object' }) // => true
      isPlainObject({}) // => true
      isPlainObject(undefined) // => false
      isPlainObject(null) // => false
      isPlainObject(false) // => false
      isPlainObject(true) // => false
      isPlainObject(NaN) // => false
      isPlainObject(Infinity) // => false
      isPlainObject(0) // => false
      isPlainObject('string') // => false
      isPlainObject([]) // => false
      isPlainObject(new ArrayBuffer(0)) // => false
      isPlainObject(new Date()) // => false
      isPlainObject(new Map()) // => false
      isPlainObject(Promise.resolve()) // => false
      isPlainObject(new Set()) // => false
      isPlainObject(new WeakMap()) // => false
      isPlainObject(new WeakSet()) // => false