Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1101 from zloirock/iterator-helpers
Iterator helpers proposal changes
- Loading branch information
Showing
53 changed files
with
595 additions
and
288 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
require('../../modules/es.object.to-string'); | ||
require('../../modules/es.promise'); | ||
require('../../modules/esnext.async-iterator.constructor'); | ||
require('../../modules/esnext.async-iterator.indexed'); | ||
|
||
var entryUnbind = require('../../internals/entry-unbind'); | ||
|
||
module.exports = entryUnbind('AsyncIterator', 'indexed'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
require('../../modules/es.object.to-string'); | ||
require('../../modules/esnext.iterator.constructor'); | ||
require('../../modules/esnext.iterator.indexed'); | ||
|
||
var entryUnbind = require('../../internals/entry-unbind'); | ||
|
||
module.exports = entryUnbind('Iterator', 'indexed'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
var call = require('../internals/function-call'); | ||
var getBuiltIn = require('../internals/get-built-in'); | ||
var getMethod = require('../internals/get-method'); | ||
|
||
module.exports = function (iterator, method, argument, reject) { | ||
try { | ||
var returnMethod = getMethod(iterator, 'return'); | ||
if (returnMethod) { | ||
return getBuiltIn('Promise').resolve(call(returnMethod, iterator)).then(function () { | ||
method(argument); | ||
}, function (error) { | ||
reject(error); | ||
}); | ||
} | ||
} catch (error2) { | ||
return reject(error2); | ||
} method(argument); | ||
}; |
Oops, something went wrong.