[6a3a178] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
---|
| 4 | value: true
|
---|
| 5 | });
|
---|
| 6 | exports.default = doUntil;
|
---|
| 7 |
|
---|
| 8 | var _doWhilst = require('./doWhilst');
|
---|
| 9 |
|
---|
| 10 | var _doWhilst2 = _interopRequireDefault(_doWhilst);
|
---|
| 11 |
|
---|
| 12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
---|
| 13 |
|
---|
| 14 | /**
|
---|
| 15 | * Like ['doWhilst']{@link module:ControlFlow.doWhilst}, except the `test` is inverted. Note the
|
---|
| 16 | * argument ordering differs from `until`.
|
---|
| 17 | *
|
---|
| 18 | * @name doUntil
|
---|
| 19 | * @static
|
---|
| 20 | * @memberOf module:ControlFlow
|
---|
| 21 | * @method
|
---|
| 22 | * @see [async.doWhilst]{@link module:ControlFlow.doWhilst}
|
---|
| 23 | * @category Control Flow
|
---|
| 24 | * @param {AsyncFunction} iteratee - An async function which is called each time
|
---|
| 25 | * `test` fails. Invoked with (callback).
|
---|
| 26 | * @param {Function} test - synchronous truth test to perform after each
|
---|
| 27 | * execution of `iteratee`. Invoked with any non-error callback results of
|
---|
| 28 | * `iteratee`.
|
---|
| 29 | * @param {Function} [callback] - A callback which is called after the test
|
---|
| 30 | * function has passed and repeated execution of `iteratee` has stopped. `callback`
|
---|
| 31 | * will be passed an error and any arguments passed to the final `iteratee`'s
|
---|
| 32 | * callback. Invoked with (err, [results]);
|
---|
| 33 | */
|
---|
| 34 | function doUntil(iteratee, test, callback) {
|
---|
| 35 | (0, _doWhilst2.default)(iteratee, function () {
|
---|
| 36 | return !test.apply(this, arguments);
|
---|
| 37 | }, callback);
|
---|
| 38 | }
|
---|
| 39 | module.exports = exports['default']; |
---|