프로젝트

일반

사용자정보

통계
| 개정판:

root / HServer / 00.Server / 00.Program / node_modules / async / constant.js

이력 | 보기 | 이력해설 | 다운로드 (1.76 KB)

1 39 HKM
'use strict';
2
3
Object.defineProperty(exports, "__esModule", {
4
    value: true
5
});
6
7
var _rest = require('./internal/rest');
8
9
var _rest2 = _interopRequireDefault(_rest);
10
11
var _initialParams = require('./internal/initialParams');
12
13
var _initialParams2 = _interopRequireDefault(_initialParams);
14
15
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
17
/**
18
 * Returns a function that when called, calls-back with the values provided.
19
 * Useful as the first function in a [`waterfall`]{@link module:ControlFlow.waterfall}, or for plugging values in to
20
 * [`auto`]{@link module:ControlFlow.auto}.
21
 *
22
 * @name constant
23
 * @static
24
 * @memberOf module:Utils
25
 * @method
26
 * @category Util
27
 * @param {...*} arguments... - Any number of arguments to automatically invoke
28
 * callback with.
29
 * @returns {Function} Returns a function that when invoked, automatically
30
 * invokes the callback with the previous given arguments.
31
 * @example
32
 *
33
 * async.waterfall([
34
 *     async.constant(42),
35
 *     function (value, next) {
36
 *         // value === 42
37
 *     },
38
 *     //...
39
 * ], callback);
40
 *
41
 * async.waterfall([
42
 *     async.constant(filename, "utf8"),
43
 *     fs.readFile,
44
 *     function (fileData, next) {
45
 *         //...
46
 *     }
47
 *     //...
48
 * ], callback);
49
 *
50
 * async.auto({
51
 *     hostname: async.constant("https://server.net/"),
52
 *     port: findFreePort,
53
 *     launchServer: ["hostname", "port", function (options, cb) {
54
 *         startServer(options, cb);
55
 *     }],
56
 *     //...
57
 * }, callback);
58
 */
59
exports.default = (0, _rest2.default)(function (values) {
60
    var args = [null].concat(values);
61
    return (0, _initialParams2.default)(function (ignoredArgs, callback) {
62
        return callback.apply(this, args);
63
    });
64
});
65
module.exports = exports['default'];