CreateIterResultObject.js 432 B

12345678910111213141516171819
  1. 'use strict';
  2. var GetIntrinsic = require('get-intrinsic');
  3. var $TypeError = GetIntrinsic('%TypeError%');
  4. var Type = require('./Type');
  5. // https://ecma-international.org/ecma-262/6.0/#sec-createiterresultobject
  6. module.exports = function CreateIterResultObject(value, done) {
  7. if (Type(done) !== 'Boolean') {
  8. throw new $TypeError('Assertion failed: Type(done) is not Boolean');
  9. }
  10. return {
  11. value: value,
  12. done: done
  13. };
  14. };