source: trip-planner-front/node_modules/async/constant.js@ 188ee53

Last change on this file since 188ee53 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

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