|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
938 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 | var call = require('../internals/function-call');
|
|---|
| 3 | var anObject = require('../internals/an-object');
|
|---|
| 4 | var getBuiltIn = require('../internals/get-built-in');
|
|---|
| 5 | var getMethod = require('../internals/get-method');
|
|---|
| 6 |
|
|---|
| 7 | module.exports = function (iterator, method, argument, reject) {
|
|---|
| 8 | try {
|
|---|
| 9 | var returnMethod = getMethod(iterator, 'return');
|
|---|
| 10 | if (returnMethod) {
|
|---|
| 11 | return getBuiltIn('Promise').resolve(call(returnMethod, iterator)).then(function (result) {
|
|---|
| 12 | try {
|
|---|
| 13 | if (method !== reject) anObject(result);
|
|---|
| 14 | } catch (error3) {
|
|---|
| 15 | reject(error3);
|
|---|
| 16 | return;
|
|---|
| 17 | }
|
|---|
| 18 | method(argument);
|
|---|
| 19 | }, function (error) {
|
|---|
| 20 | method === reject ? method(argument) : reject(error);
|
|---|
| 21 | });
|
|---|
| 22 | }
|
|---|
| 23 | } catch (error2) {
|
|---|
| 24 | // the original error (`argument`) takes priority over `return()` errors
|
|---|
| 25 | return method === reject ? reject(argument) : reject(error2);
|
|---|
| 26 | } method(argument);
|
|---|
| 27 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.