root / HServer / 00.Server / 00.Program / node_modules / async / until.js
이력 | 보기 | 이력해설 | 다운로드 (1.47 KB)
| 1 | 39 | HKM | 'use strict';
|
|---|---|---|---|
| 2 | |||
| 3 | Object.defineProperty(exports, "__esModule", {
|
||
| 4 | value: true |
||
| 5 | }); |
||
| 6 | exports.default = until;
|
||
| 7 | |||
| 8 | var _whilst = require('./whilst'); |
||
| 9 | |||
| 10 | var _whilst2 = _interopRequireDefault(_whilst);
|
||
| 11 | |||
| 12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
||
| 13 | |||
| 14 | /**
|
||
| 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.
|
||
| 18 | *
|
||
| 19 | * The inverse of [whilst]{@link module:ControlFlow.whilst}.
|
||
| 20 | *
|
||
| 21 | * @name until
|
||
| 22 | * @static
|
||
| 23 | * @memberOf module:ControlFlow
|
||
| 24 | * @method
|
||
| 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]);
|
||
| 36 | */
|
||
| 37 | function until(test, fn, callback) { |
||
| 38 | (0, _whilst2.default)(function () { |
||
| 39 | return !test.apply(this, arguments); |
||
| 40 | }, fn, callback); |
||
| 41 | } |
||
| 42 | module.exports = exports['default']; |