CreateIterResultObject.js 349 B

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