e7b5ee7f66f95d2cd0b3cbf48827b84c1e603370
[yaffs-website] / node_modules / grunt-uncss / node_modules / async / doUntil.js
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 {Function} fn - A function which is called each time `test` fails.
25  * The function is passed a `callback(err)`, which must be called once it has
26  * completed with an optional `err` argument. Invoked with (callback).
27  * @param {Function} test - synchronous truth test to perform after each
28  * execution of `fn`. Invoked with the non-error callback results of `fn`.
29  * @param {Function} [callback] - A callback which is called after the test
30  * function has passed and repeated execution of `fn` has stopped. `callback`
31  * will be passed an error and any arguments passed to the final `fn`'s
32  * callback. Invoked with (err, [results]);
33  */
34 function doUntil(fn, test, callback) {
35     (0, _doWhilst2.default)(fn, function () {
36         return !test.apply(this, arguments);
37     }, callback);
38 }
39 module.exports = exports['default'];