index.js 318 B

123456789
  1. module.exports = function isArrayish(obj) {
  2. if (!obj || typeof obj === 'string') {
  3. return false;
  4. }
  5. return obj instanceof Array || Array.isArray(obj) ||
  6. (obj.length >= 0 && (obj.splice instanceof Function ||
  7. (Object.getOwnPropertyDescriptor(obj, (obj.length - 1)) && obj.constructor.name !== 'String')));
  8. };