1 | ;
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 |
|
7 | exports.default = function (...args) {
|
8 | return function (...ignoredArgs /*, callback*/) {
|
9 | var callback = ignoredArgs.pop();
|
10 | return callback(null, ...args);
|
11 | };
|
12 | };
|
13 |
|
14 | module.exports = exports["default"]; /**
|
15 | * Returns a function that when called, calls-back with the values provided.
|
16 | * Useful as the first function in a [`waterfall`]{@link module:ControlFlow.waterfall}, or for plugging values in to
|
17 | * [`auto`]{@link module:ControlFlow.auto}.
|
18 | *
|
19 | * @name constant
|
20 | * @static
|
21 | * @memberOf module:Utils
|
22 | * @method
|
23 | * @category Util
|
24 | * @param {...*} arguments... - Any number of arguments to automatically invoke
|
25 | * callback with.
|
26 | * @returns {AsyncFunction} Returns a function that when invoked, automatically
|
27 | * invokes the callback with the previous given arguments.
|
28 | * @example
|
29 | *
|
30 | * async.waterfall([
|
31 | * async.constant(42),
|
32 | * function (value, next) {
|
33 | * // value === 42
|
34 | * },
|
35 | * //...
|
36 | * ], callback);
|
37 | *
|
38 | * async.waterfall([
|
39 | * async.constant(filename, "utf8"),
|
40 | * fs.readFile,
|
41 | * function (fileData, next) {
|
42 | * //...
|
43 | * }
|
44 | * //...
|
45 | * ], callback);
|
46 | *
|
47 | * async.auto({
|
48 | * hostname: async.constant("https://server.net/"),
|
49 | * port: findFreePort,
|
50 | * launchServer: ["hostname", "port", function (options, cb) {
|
51 | * startServer(options, cb);
|
52 | * }],
|
53 | * //...
|
54 | * }, callback);
|
55 | */ |
\ | No newline at end of file |