mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 09:27:49 +00:00
wip: migrate to bun
This commit is contained in:
24
src/hasIn.ts
Normal file
24
src/hasIn.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* 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 {string} key The key to check.
|
||||
* @returns {boolean} Returns `true` if `key` exists, else `false`.
|
||||
* @see has, hasPath, hasPathIn
|
||||
* @example
|
||||
*
|
||||
* const object = create({ 'a': create({ 'b': 2 }) })
|
||||
*
|
||||
* hasIn(object, 'a')
|
||||
* // => true
|
||||
*
|
||||
* hasIn(object, 'b')
|
||||
* // => false
|
||||
*/
|
||||
function hasIn(object, key) {
|
||||
return object != null && key in Object(object);
|
||||
}
|
||||
|
||||
export default hasIn;
|
||||
Reference in New Issue
Block a user