Function isPlainObject

  • Checks if value is a plain object, that is, an object created by the Object constructor or one with a [[Prototype]] of null.

    Parameters

    • value: any

      The value to check.

    Returns boolean

    Returns true if value is a plain object, else false.

    5.6.0

    function Foo() {
    this.a = 1
    }

    isPlainObject(new Foo)
    // => false

    isPlainObject([1, 2, 3])
    // => false

    isPlainObject({ 'x': 0, 'y': 0 })
    // => true

    isPlainObject(Object.create(null))
    // => true