isArrayLikeObject.js 742 B

12345678910111213141516171819202122232425262728293031323334
  1. var isArrayLike = require('./isArrayLike'),
  2. isObjectLike = require('./isObjectLike');
  3. /**
  4. * This method is like `_.isArrayLike` except that it also checks if `value`
  5. * is an object.
  6. *
  7. * @static
  8. * @memberOf _
  9. * @since 4.0.0
  10. * @category Lang
  11. * @param {*} value The value to check.
  12. * @returns {boolean} Returns `true` if `value` is an array-like object,
  13. * else `false`.
  14. * @example
  15. *
  16. * _.isArrayLikeObject([1, 2, 3]);
  17. * // => true
  18. *
  19. * _.isArrayLikeObject(document.body.children);
  20. * // => true
  21. *
  22. * _.isArrayLikeObject('abc');
  23. * // => false
  24. *
  25. * _.isArrayLikeObject(_.noop);
  26. * // => false
  27. */
  28. function isArrayLikeObject(value) {
  29. return isObjectLike(value) && isArrayLike(value);
  30. }
  31. module.exports = isArrayLikeObject;