index.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /**
  2. * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
  3. * Build: `lodash modularize modern exports="npm" -o ./npm/`
  4. * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
  5. * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
  6. * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  7. * Available under MIT license <http://lodash.com/license>
  8. */
  9. var objectTypes = require('lodash._objecttypes');
  10. /**
  11. * Checks if `value` is the language type of Object.
  12. * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  13. *
  14. * @static
  15. * @memberOf _
  16. * @category Objects
  17. * @param {*} value The value to check.
  18. * @returns {boolean} Returns `true` if the `value` is an object, else `false`.
  19. * @example
  20. *
  21. * _.isObject({});
  22. * // => true
  23. *
  24. * _.isObject([1, 2, 3]);
  25. * // => true
  26. *
  27. * _.isObject(1);
  28. * // => false
  29. */
  30. function isObject(value) {
  31. // check if the value is the ECMAScript language type of Object
  32. // http://es5.github.io/#x8
  33. // and avoid a V8 bug
  34. // http://code.google.com/p/v8/issues/detail?id=2291
  35. return !!(value && objectTypes[typeof value]);
  36. }
  37. module.exports = isObject;