Checks if `path` is a direct or inherited property of `object`.
const object = create({ 'a': create({ 'b': 2 }) })
hasIn(object, 'a')
// => true
hasIn(object, 'b')
// => false
Name | Type | Attribute | Description |
---|---|---|---|
object | The object to query. | ||
key | The key to check. |
{ "comment": "/**\r\n * Checks if `path` is a direct or inherited property of `object`.\r\n *\r\n * @since 4.0.0\r\n * @category Object\r\n * @param {Object} object The object to query.\r\n * @param {string} key The key to check.\r\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\r\n * @see has, hasPath, hasPathIn\r\n * @example\r\n *\r\n * const object = create({ 'a': create({ 'b': 2 }) })\r\n *\r\n * hasIn(object, 'a')\r\n * // => true\r\n *\r\n * hasIn(object, 'b')\r\n * // => false\r\n */", "meta": { "range": [ 469, 551 ], "filename": "hasIn.js", "lineno": 20, "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo", "code": { "id": "astnode100003300", "name": "hasIn", "type": "FunctionDeclaration", "paramnames": [ "object", "key" ] } }, "description": "Checks if `path` is a direct or inherited property of `object`.", "since": "4.0.0", "tags": [ { "originalTitle": "category", "title": "category", "text": "Object", "value": "Object" } ], "params": [ { "type": { "names": [ "Object" ] }, "description": "The object to query.", "name": "object" }, { "type": { "names": [ "string" ] }, "description": "The key to check.", "name": "key" } ], "returns": [ { "type": { "names": [ "boolean" ] }, "description": "Returns `true` if `key` exists, else `false`." } ], "see": [ "has, hasPath, hasPathIn" ], "examples": [ "const object = create({ 'a': create({ 'b': 2 }) })\r\rhasIn(object, 'a')\r// => true\r\rhasIn(object, 'b')\r// => false" ], "name": "hasIn", "longname": "hasIn", "kind": "function", "scope": "global", "___id": "T000002R000348", "___s": true, "filepath": "hasIn.js" }