Converts value to a plain object flattening inherited enumerable string keyed properties of value to own properties of the plain object.
value
The value to convert.
Returns the converted plain object.
5.13.0
function Foo() { this.b = 2}Foo.prototype.c = 3assign({ 'a': 1 }, new Foo)// => { 'a': 1, 'b': 2 }assign({ 'a': 1 }, toPlainObject(new Foo))// => { 'a': 1, 'b': 2, 'c': 3 } Copy
function Foo() { this.b = 2}Foo.prototype.c = 3assign({ 'a': 1 }, new Foo)// => { 'a': 1, 'b': 2 }assign({ 'a': 1 }, toPlainObject(new Foo))// => { 'a': 1, 'b': 2, 'c': 3 }
Converts
value
to a plain object flattening inherited enumerable string keyed properties ofvalue
to own properties of the plain object.