summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlex Early <alexander.early@gmail.com>2016-07-12 16:50:57 -0700
committerGitHub <noreply@github.com>2016-07-12 16:50:57 -0700
commitbc3ca233331139bbc9b02008e67e2e5bdfd38f87 (patch)
treef2f7007112f1688a169bea46349eb8b879f2bb22 /lib
parentd31dc8e6798c0e1315643db1e742d85a283bdbcc (diff)
parent3bf024307713b619f5775d4fc8e44d10e98afc88 (diff)
downloadasync-bc3ca233331139bbc9b02008e67e2e5bdfd38f87.tar.gz
Merge pull request #1239 from caolan/kill-iterator
Remove async.iterator
Diffstat (limited to 'lib')
-rw-r--r--lib/index.js3
-rw-r--r--lib/iterator.js48
2 files changed, 0 insertions, 51 deletions
diff --git a/lib/index.js b/lib/index.js
index 28b87d6..8a2c7ca 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -54,7 +54,6 @@ import filter from './filter';
import filterLimit from './filterLimit';
import filterSeries from './filterSeries';
import forever from './forever';
-import iterator from './iterator';
import log from './log';
import map from './map';
import mapLimit from './mapLimit';
@@ -129,7 +128,6 @@ export default {
filterLimit: filterLimit,
filterSeries: filterSeries,
forever: forever,
- iterator: iterator,
log: log,
map: map,
mapLimit: mapLimit,
@@ -222,7 +220,6 @@ export {
filterLimit as filterLimit,
filterSeries as filterSeries,
forever as forever,
- iterator as iterator,
log as log,
map as map,
mapLimit as mapLimit,
diff --git a/lib/iterator.js b/lib/iterator.js
deleted file mode 100644
index fafd960..0000000
--- a/lib/iterator.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Creates an iterator function which calls the next function in the `tasks`
- * array, returning a continuation to call the next one after that. It's also
- * possible to “peek” at the next iterator with `iterator.next()`.
- *
- * This function is used internally by the `async` module, but can be useful
- * when you want to manually control the flow of functions in series.
- *
- * @name iterator
- * @static
- * @memberOf module:ControlFlow
- * @method
- * @category Control Flow
- * @param {Array} tasks - An array of functions to run.
- * @returns The next function to run in the series.
- * @example
- *
- * var iterator = async.iterator([
- * function() { sys.p('one'); },
- * function() { sys.p('two'); },
- * function() { sys.p('three'); }
- * ]);
- *
- * node> var iterator2 = iterator();
- * 'one'
- * node> var iterator3 = iterator2();
- * 'two'
- * node> iterator3();
- * 'three'
- * node> var nextfn = iterator2.next();
- * node> nextfn();
- * 'three'
- */
-export default function(tasks) {
- function makeCallback(index) {
- function fn() {
- if (tasks.length) {
- tasks[index].apply(null, arguments);
- }
- return fn.next();
- }
- fn.next = function() {
- return (index < tasks.length - 1) ? makeCallback(index + 1) : null;
- };
- return fn;
- }
- return makeCallback(0);
-}