massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / core-js / internals / iterator-close.js
1 var call = require('../internals/function-call');
2 var anObject = require('../internals/an-object');
3 var getMethod = require('../internals/get-method');
4
5 module.exports = function (iterator, kind, value) {
6   var innerResult, innerError;
7   anObject(iterator);
8   try {
9     innerResult = getMethod(iterator, 'return');
10     if (!innerResult) {
11       if (kind === 'throw') throw value;
12       return value;
13     }
14     innerResult = call(innerResult, iterator);
15   } catch (error) {
16     innerError = true;
17     innerResult = error;
18   }
19   if (kind === 'throw') throw value;
20   if (innerError) throw innerResult;
21   anObject(innerResult);
22   return value;
23 };