IteratorStep.js 594 B

123456789101112131415161718
  1. 'use strict';
  2. var IteratorComplete = require('es-abstract/2022/IteratorComplete');
  3. var IteratorNext = require('./IteratorNext');
  4. var Type = require('es-abstract/2022/Type');
  5. var assertRecord = require('es-abstract/helpers/assertRecord');
  6. // https://262.ecma-international.org/14.0/#sec-iteratorstep
  7. module.exports = function IteratorStep(iteratorRecord) {
  8. assertRecord(Type, 'Iterator Record', 'iteratorRecord', iteratorRecord);
  9. var result = IteratorNext(iteratorRecord); // step 1
  10. var done = IteratorComplete(result); // step 2
  11. return done === true ? false : result; // steps 3-4
  12. };