IteratorComplete.js 445 B

12345678910111213141516
  1. 'use strict';
  2. var $TypeError = require('es-errors/type');
  3. var Get = require('./Get');
  4. var ToBoolean = require('./ToBoolean');
  5. var Type = require('./Type');
  6. // https://262.ecma-international.org/6.0/#sec-iteratorcomplete
  7. module.exports = function IteratorComplete(iterResult) {
  8. if (Type(iterResult) !== 'Object') {
  9. throw new $TypeError('Assertion failed: Type(iterResult) is not Object');
  10. }
  11. return ToBoolean(Get(iterResult, 'done'));
  12. };