time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

isObject.js (733B)


      1 /**
      2  * Checks if `value` is the
      3  * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
      4  * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
      5  *
      6  * @static
      7  * @memberOf _
      8  * @since 0.1.0
      9  * @category Lang
     10  * @param {*} value The value to check.
     11  * @returns {boolean} Returns `true` if `value` is an object, else `false`.
     12  * @example
     13  *
     14  * _.isObject({});
     15  * // => true
     16  *
     17  * _.isObject([1, 2, 3]);
     18  * // => true
     19  *
     20  * _.isObject(_.noop);
     21  * // => true
     22  *
     23  * _.isObject(null);
     24  * // => false
     25  */
     26 function isObject(value) {
     27   var type = typeof value;
     28   return value != null && (type == 'object' || type == 'function');
     29 }
     30 
     31 module.exports = isObject;