main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
657 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 | var call = require('../internals/function-call');
|
---|
3 | var anObject = require('../internals/an-object');
|
---|
4 | var getMethod = require('../internals/get-method');
|
---|
5 |
|
---|
6 | module.exports = function (iterator, kind, value) {
|
---|
7 | var innerResult, innerError;
|
---|
8 | anObject(iterator);
|
---|
9 | try {
|
---|
10 | innerResult = getMethod(iterator, 'return');
|
---|
11 | if (!innerResult) {
|
---|
12 | if (kind === 'throw') throw value;
|
---|
13 | return value;
|
---|
14 | }
|
---|
15 | innerResult = call(innerResult, iterator);
|
---|
16 | } catch (error) {
|
---|
17 | innerError = true;
|
---|
18 | innerResult = error;
|
---|
19 | }
|
---|
20 | if (kind === 'throw') throw value;
|
---|
21 | if (innerError) throw innerResult;
|
---|
22 | anObject(innerResult);
|
---|
23 | return value;
|
---|
24 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.