2
0

is-iterable.js 352 B

12345678910111213
  1. 'use strict';
  2. var isString = require('es5-ext/string/is-string')
  3. , iteratorSymbol = require('es6-symbol').iterator
  4. , isArray = Array.isArray;
  5. module.exports = function (value) {
  6. if (value == null) return false;
  7. if (isArray(value)) return true;
  8. if (isString(value)) return true;
  9. return (typeof value[iteratorSymbol] === 'function');
  10. };