Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80742 views
1
/**
2
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
3
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
4
*
5
* @static
6
* @memberOf _
7
* @category Lang
8
* @param {*} value The value to check.
9
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
10
* @example
11
*
12
* _.isObject({});
13
* // => true
14
*
15
* _.isObject([1, 2, 3]);
16
* // => true
17
*
18
* _.isObject(1);
19
* // => false
20
*/
21
function isObject(value) {
22
// Avoid a V8 JIT bug in Chrome 19-20.
23
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
24
var type = typeof value;
25
return !!value && (type == 'object' || type == 'function');
26
}
27
28
module.exports = isObject;
29
30