IteratorValue.js 390 B

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