Files
lodash/hasIn.js
John-David Dalton 6cb3460fce Remove semicolons.
2017-02-05 22:22:04 -08:00

34 lines
753 B
JavaScript

import baseHasIn from './.internal/baseHasIn.js'
import hasPath from './.internal/hasPath.js'
/**
* Checks if `path` is a direct or inherited property of `object`.
*
* @since 4.0.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path to check.
* @returns {boolean} Returns `true` if `path` exists, else `false`.
* @see has, get, set, unset
* @example
*
* const object = create({ 'a': create({ 'b': 2 }) })
*
* hasIn(object, 'a')
* // => true
*
* hasIn(object, 'a.b')
* // => true
*
* hasIn(object, ['a', 'b'])
* // => true
*
* hasIn(object, 'b')
* // => false
*/
function hasIn(object, path) {
return object != null && hasPath(object, path, baseHasIn)
}
export default hasIn