Checks if `value` is a plain object, that is, an object created by the `Object` constructor or one with a `[[Prototype]]` of `null`.
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
Name | Type | Attribute | Description |
---|---|---|---|
value | The value to check. |
{ "comment": "/**\r\n * Checks if `value` is a plain object, that is, an object created by the\r\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\r\n *\r\n * @since 0.8.0\r\n * @category Lang\r\n * @param {*} value The value to check.\r\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\r\n * @example\r\n *\r\n * function Foo() {\r\n * this.a = 1\r\n * }\r\n *\r\n * isPlainObject(new Foo)\r\n * // => false\r\n *\r\n * isPlainObject([1, 2, 3])\r\n * // => false\r\n *\r\n * isPlainObject({ 'x': 0, 'y': 0 })\r\n * // => true\r\n *\r\n * isPlainObject(Object.create(null))\r\n * // => true\r\n */", "meta": { "range": [ 1008, 1422 ], "filename": "isPlainObject.js", "lineno": 39, "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo", "code": { "id": "astnode100005102", "name": "isPlainObject", "type": "FunctionDeclaration", "paramnames": [ "value" ] }, "vars": { "proto": "isPlainObject~proto", "Ctor": "isPlainObject~Ctor" } }, "description": "Checks if `value` is a plain object, that is, an object created by the\r`Object` constructor or one with a `[[Prototype]]` of `null`.", "since": "0.8.0", "tags": [ { "originalTitle": "category", "title": "category", "text": "Lang", "value": "Lang" } ], "params": [ { "type": { "names": [ "*" ] }, "description": "The value to check.", "name": "value" } ], "returns": [ { "type": { "names": [ "boolean" ] }, "description": "Returns `true` if `value` is a plain object, else `false`." } ], "examples": [ "function Foo() {\r this.a = 1\r}\r\risPlainObject(new Foo)\r// => false\r\risPlainObject([1, 2, 3])\r// => false\r\risPlainObject({ 'x': 0, 'y': 0 })\r// => true\r\risPlainObject(Object.create(null))\r// => true" ], "name": "isPlainObject", "longname": "isPlainObject", "kind": "function", "scope": "global", "___id": "T000002R000488", "___s": true, "filepath": "isPlainObject.js" }