IteratorValue.js 443 B

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