mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 14:37:49 +00:00
28 lines
576 B
JavaScript
28 lines
576 B
JavaScript
/**
|
|
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
* and has a `typeof` result of "object".
|
|
*
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
* @example
|
|
*
|
|
* isObjectLike({})
|
|
* // => true
|
|
*
|
|
* isObjectLike([1, 2, 3])
|
|
* // => true
|
|
*
|
|
* isObjectLike(Function)
|
|
* // => false
|
|
*
|
|
* isObjectLike(null)
|
|
* // => false
|
|
*/
|
|
function isObjectLike(value) {
|
|
return typeof value === 'object' && value !== null
|
|
}
|
|
|
|
export default isObjectLike
|