You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

isObject.js 733B

12345678910111213141516171819202122232425262728293031
  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. module.exports = isObject;