You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

IteratorNext.js 495B

123456789101112131415161718
  1. 'use strict';
  2. var GetIntrinsic = require('../GetIntrinsic');
  3. var $TypeError = GetIntrinsic('%TypeError%');
  4. var Invoke = require('./Invoke');
  5. var Type = require('./Type');
  6. // https://ecma-international.org/ecma-262/6.0/#sec-iteratornext
  7. module.exports = function IteratorNext(iterator, value) {
  8. var result = Invoke(iterator, 'next', arguments.length < 2 ? [] : [value]);
  9. if (Type(result) !== 'Object') {
  10. throw new $TypeError('iterator next must return an object');
  11. }
  12. return result;
  13. };