get-iterator.js 401 B

123456789
  1. var anObject = require('../internals/an-object');
  2. var getIteratorMethod = require('../internals/get-iterator-method');
  3. module.exports = function (it, usingIterator) {
  4. var iteratorMethod = arguments.length < 2 ? getIteratorMethod(it) : usingIterator;
  5. if (typeof iteratorMethod != 'function') {
  6. throw TypeError(String(it) + ' is not iterable');
  7. } return anObject(iteratorMethod.call(it));
  8. };