diff options
author | Alexander Early <alexander.early@gmail.com> | 2016-06-07 18:32:02 -0700 |
---|---|---|
committer | Alexander Early <alexander.early@gmail.com> | 2016-06-07 18:32:02 -0700 |
commit | 428a3004417c1c456dceecc1ba1c68afe24122fc (patch) | |
tree | 07b74085c7e31740909e24ad2f35f5f239cc2ab9 /lib/whilst.js | |
parent | 6932085d7ca452e8c081ea709d8994fcb0246e27 (diff) | |
download | async-428a3004417c1c456dceecc1ba1c68afe24122fc.tar.gz |
fix new lint errors
Diffstat (limited to 'lib/whilst.js')
-rw-r--r-- | lib/whilst.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/whilst.js b/lib/whilst.js index 079fd85..ee1c19a 100644 --- a/lib/whilst.js +++ b/lib/whilst.js @@ -11,13 +11,14 @@ import rest from 'lodash/rest'; * @category Control Flow * @param {Function} test - synchronous truth test to perform before each * execution of `fn`. Invoked with (). - * @param {Function} fn - A function which is called each time `test` passes. + * @param {Function} iteratee - A function which is called each time `test` passes. * The function is passed a `callback(err)`, which must be called once it has * completed with an optional `err` argument. Invoked with (callback). * @param {Function} [callback] - A callback which is called after the test * function has failed and repeated execution of `fn` has stopped. `callback` * will be passed an error and any arguments passed to the final `fn`'s * callback. Invoked with (err, [results]); + * @returns undefined * @example * * var count = 0; @@ -34,13 +35,13 @@ import rest from 'lodash/rest'; * } * ); */ -export default function whilst(test, iteratee, cb) { - cb = cb || noop; - if (!test()) return cb(null); +export default function whilst(test, iteratee, callback) { + callback = callback || noop; + if (!test()) return callback(null); var next = rest(function(err, args) { - if (err) return cb(err); + if (err) return callback(err); if (test.apply(this, args)) return iteratee(next); - cb.apply(null, [null].concat(args)); + callback.apply(null, [null].concat(args)); }); iteratee(next); } |