is-array-like.js 456 B

1234567891011121314
  1. 'use strict';
  2. var isFunction = require('../function/is-function')
  3. , isObject = require('./is-object');
  4. module.exports = function (x) {
  5. return ((x != null) && (typeof x.length === 'number') &&
  6. // Just checking ((typeof x === 'object') && (typeof x !== 'function'))
  7. // won't work right for some cases, e.g.:
  8. // type of instance of NodeList in Safari is a 'function'
  9. ((isObject(x) && !isFunction(x)) || (typeof x === "string"))) || false;
  10. };