Function toPlainObject

  • Converts value to a plain object flattening inherited enumerable string keyed properties of value to own properties of the plain object.

    Type Parameters

    • T extends unknown

    Parameters

    • value: T

      The value to convert.

    Returns T

    Returns the converted plain object.

    5.13.0

    function Foo() {
    this.b = 2
    }

    Foo.prototype.c = 3

    assign({ 'a': 1 }, new Foo)
    // => { 'a': 1, 'b': 2 }

    assign({ 'a': 1 }, toPlainObject(new Foo))
    // => { 'a': 1, 'b': 2, 'c': 3 }