mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 09:47:48 +00:00
Simplify has and hasIn.
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
/** Used to check objects for own properties. */
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty
|
||||
|
||||
/**
|
||||
* The base implementation of `has` without support for deep paths.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} [object] The object to query.
|
||||
* @param {Array|string} key The key to check.
|
||||
* @returns {boolean} Returns `true` if `key` exists, else `false`.
|
||||
*/
|
||||
function baseHas(object, key) {
|
||||
return object != null && hasOwnProperty.call(object, key)
|
||||
}
|
||||
|
||||
export default baseHas
|
||||
@@ -1,13 +0,0 @@
|
||||
/**
|
||||
* The base implementation of `hasIn` without support for deep paths.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} [object] The object to query.
|
||||
* @param {Array|string} key The key to check.
|
||||
* @returns {boolean} Returns `true` if `key` exists, else `false`.
|
||||
*/
|
||||
function baseHasIn(object, key) {
|
||||
return object != null && key in Object(object)
|
||||
}
|
||||
|
||||
export default baseHasIn
|
||||
Reference in New Issue
Block a user