get-iterator.js 347 B

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