is-iterable.js 493 B

123456789101112131415
  1. var global = require('../internals/global');
  2. var classof = require('../internals/classof');
  3. var hasOwn = require('../internals/has-own-property');
  4. var wellKnownSymbol = require('../internals/well-known-symbol');
  5. var Iterators = require('../internals/iterators');
  6. var ITERATOR = wellKnownSymbol('iterator');
  7. var Object = global.Object;
  8. module.exports = function (it) {
  9. var O = Object(it);
  10. return O[ITERATOR] !== undefined
  11. || '@@iterator' in O
  12. || hasOwn(Iterators, classof(O));
  13. };