_isArray.js 452 B

123456789101112131415
  1. /**
  2. * Tests whether or not an object is an array.
  3. *
  4. * @private
  5. * @param {*} val The object to test.
  6. * @return {Boolean} `true` if `val` is an array, `false` otherwise.
  7. * @example
  8. *
  9. * _isArray([]); //=> true
  10. * _isArray(null); //=> false
  11. * _isArray({}); //=> false
  12. */
  13. export default Array.isArray || function _isArray(val) {
  14. return val != null && val.length >= 0 && Object.prototype.toString.call(val) === '[object Array]';
  15. };