c83ae3b18fb5212a3c2ac651ef6547894f4dacef2764391793a8f7e6afbaa695936ba7ac7d06c797c28bbf1174b4b4a816a1e0551a3aa7e2e5d030e7baf108 657 B

123456789101112131415161718192021222324
  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. 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. };