odin-js-fundamentals-part-4/node_modules/object.groupby/aos/IteratorStep.js

19 lines
594 B
JavaScript
Raw Permalink Normal View History

2024-01-05 19:30:21 +00:00
'use strict';
var IteratorComplete = require('es-abstract/2022/IteratorComplete');
var IteratorNext = require('./IteratorNext');
var Type = require('es-abstract/2022/Type');
var assertRecord = require('es-abstract/helpers/assertRecord');
// https://262.ecma-international.org/14.0/#sec-iteratorstep
module.exports = function IteratorStep(iteratorRecord) {
assertRecord(Type, 'Iterator Record', 'iteratorRecord', iteratorRecord);
var result = IteratorNext(iteratorRecord); // step 1
var done = IteratorComplete(result); // step 2
return done === true ? false : result; // steps 3-4
};