|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
861 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | var $TypeError = require('es-errors/type');
|
|---|
| 4 |
|
|---|
| 5 | var IteratorStep = require('./IteratorStep');
|
|---|
| 6 | var IteratorValue = require('./IteratorValue');
|
|---|
| 7 |
|
|---|
| 8 | var isIteratorRecord = require('../helpers/records/iterator-record');
|
|---|
| 9 |
|
|---|
| 10 | // https://262.ecma-international.org/16.0/#sec-iteratorstepvalue
|
|---|
| 11 |
|
|---|
| 12 | module.exports = function IteratorStepValue(iteratorRecord) {
|
|---|
| 13 | if (!isIteratorRecord(iteratorRecord)) {
|
|---|
| 14 | throw new $TypeError('Assertion failed: `iteratorRecord` must be an Iterator Record');
|
|---|
| 15 | }
|
|---|
| 16 |
|
|---|
| 17 | var result = IteratorStep(iteratorRecord); // step 1
|
|---|
| 18 | if (!result || result === 'DONE') { // step 2
|
|---|
| 19 | return result; // step 2.a
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | var value;
|
|---|
| 23 | try {
|
|---|
| 24 | value = IteratorValue(result); // step 3
|
|---|
| 25 | } catch (e) { // step 4
|
|---|
| 26 | // eslint-disable-next-line no-param-reassign
|
|---|
| 27 | iteratorRecord['[[Done]]'] = true; // step 4.a
|
|---|
| 28 | throw e; // step 5
|
|---|
| 29 | }
|
|---|
| 30 |
|
|---|
| 31 | return value; // step 5
|
|---|
| 32 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.