Converts `value` to a plain object flattening inherited enumerable string keyed properties of `value` to own properties of the plain object.
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 }
| Name | Type | Attribute | Description |
|---|---|---|---|
| value | The value to convert. |
{
"comment": "/**\r\n * Converts `value` to a plain object flattening inherited enumerable string\r\n * keyed properties of `value` to own properties of the plain object.\r\n *\r\n * @since 3.0.0\r\n * @category Lang\r\n * @param {*} value The value to convert.\r\n * @returns {Object} Returns the converted plain object.\r\n * @example\r\n *\r\n * function Foo() {\r\n * this.b = 2\r\n * }\r\n *\r\n * Foo.prototype.c = 3\r\n *\r\n * assign({ 'a': 1 }, new Foo)\r\n * // => { 'a': 1, 'b': 2 }\r\n *\r\n * assign({ 'a': 1 }, toPlainObject(new Foo))\r\n * // => { 'a': 1, 'b': 2, 'c': 3 }\r\n */",
"meta": {
"range": [
542,
706
],
"filename": "toPlainObject.js",
"lineno": 23,
"path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
"code": {
"id": "astnode100010159",
"name": "toPlainObject",
"type": "FunctionDeclaration",
"paramnames": [
"value"
]
},
"vars": {
"value": "toPlainObject~value",
"result": "toPlainObject~result",
"key": "toPlainObject~key",
"result[undefined]": "toPlainObject~result[undefined]"
}
},
"description": "Converts `value` to a plain object flattening inherited enumerable string\rkeyed properties of `value` to own properties of the plain object.",
"since": "3.0.0",
"tags": [
{
"originalTitle": "category",
"title": "category",
"text": "Lang",
"value": "Lang"
}
],
"params": [
{
"type": {
"names": [
"*"
]
},
"description": "The value to convert.",
"name": "value"
}
],
"returns": [
{
"type": {
"names": [
"Object"
]
},
"description": "Returns the converted plain object."
}
],
"examples": [
"function Foo() {\r this.b = 2\r}\r\rFoo.prototype.c = 3\r\rassign({ 'a': 1 }, new Foo)\r// => { 'a': 1, 'b': 2 }\r\rassign({ 'a': 1 }, toPlainObject(new Foo))\r// => { 'a': 1, 'b': 2, 'c': 3 }"
],
"name": "toPlainObject",
"longname": "toPlainObject",
"kind": "function",
"scope": "global",
"___id": "T000002R000929",
"___s": true,
"filepath": "toPlainObject.js"
}