3 Object.defineProperty(exports, "__esModule", {
6 exports.default = until;
8 var _whilst = require('./whilst');
10 var _whilst2 = _interopRequireDefault(_whilst);
12 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15 * Repeatedly call `fn` until `test` returns `true`. Calls `callback` when
16 * stopped, or an error occurs. `callback` will be passed an error and any
17 * arguments passed to the final `fn`'s callback.
19 * The inverse of [whilst]{@link module:ControlFlow.whilst}.
23 * @memberOf module:ControlFlow
25 * @see [async.whilst]{@link module:ControlFlow.whilst}
26 * @category Control Flow
27 * @param {Function} test - synchronous truth test to perform before each
28 * execution of `fn`. Invoked with ().
29 * @param {Function} fn - A function which is called each time `test` fails.
30 * The function is passed a `callback(err)`, which must be called once it has
31 * completed with an optional `err` argument. Invoked with (callback).
32 * @param {Function} [callback] - A callback which is called after the test
33 * function has passed and repeated execution of `fn` has stopped. `callback`
34 * will be passed an error and any arguments passed to the final `fn`'s
35 * callback. Invoked with (err, [results]);
37 function until(test, fn, callback) {
38 (0, _whilst2.default)(function () {
39 return !test.apply(this, arguments);
42 module.exports = exports['default'];