Sha256: a9427a4f037e08e12c1a55c89b2e19c4fc6c7314f20124fa1aa7f193f161f022

Contents?: true

Size: 1.72 KB

Versions: 48

Compression:

Stored size: 1.72 KB

Contents

'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

exports.default = function () /*...values*/{
    var values = (0, _slice2.default)(arguments);
    var args = [null].concat(values);
    return function () /*...ignoredArgs, callback*/{
        var callback = arguments[arguments.length - 1];
        return callback.apply(this, args);
    };
};

var _slice = require('./internal/slice');

var _slice2 = _interopRequireDefault(_slice);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

;

/**
 * Returns a function that when called, calls-back with the values provided.
 * Useful as the first function in a [`waterfall`]{@link module:ControlFlow.waterfall}, or for plugging values in to
 * [`auto`]{@link module:ControlFlow.auto}.
 *
 * @name constant
 * @static
 * @memberOf module:Utils
 * @method
 * @category Util
 * @param {...*} arguments... - Any number of arguments to automatically invoke
 * callback with.
 * @returns {AsyncFunction} Returns a function that when invoked, automatically
 * invokes the callback with the previous given arguments.
 * @example
 *
 * async.waterfall([
 *     async.constant(42),
 *     function (value, next) {
 *         // value === 42
 *     },
 *     //...
 * ], callback);
 *
 * async.waterfall([
 *     async.constant(filename, "utf8"),
 *     fs.readFile,
 *     function (fileData, next) {
 *         //...
 *     }
 *     //...
 * ], callback);
 *
 * async.auto({
 *     hostname: async.constant("https://server.net/"),
 *     port: findFreePort,
 *     launchServer: ["hostname", "port", function (options, cb) {
 *         startServer(options, cb);
 *     }],
 *     //...
 * }, callback);
 */
module.exports = exports['default'];

Version data entries

48 entries across 46 versions & 11 rubygems

Version Path
ilog-0.4.0 node_modules/async/constant.js
ilog-0.3.3 node_modules/async/constant.js
ela-4.1.6 node_modules/async/constant.js
ela-4.1.5 node_modules/async/constant.js
ela-4.1.4 node_modules/async/constant.js
ela-4.1.3 node_modules/async/constant.js
optimacms-0.4.3 spec/dummy/node_modules/async/constant.js
optimacms-0.4.2 spec/dummy/node_modules/async/constant.js
locomotivecms-4.0.0.alpha1 app/javascript/node_modules/async/constant.js
ela-4.1.2 node_modules/async/constant.js
ela-4.1.1 node_modules/async/constant.js
ela-4.1.0 node_modules/async/constant.js
locomotivecms-3.4.0 app/javascript/node_modules/yeoman-generator/node_modules/async/constant.js
locomotivecms-3.4.0 app/javascript/node_modules/istanbul-api/node_modules/async/constant.js
cortex-0.1.3 spec/dummy/node_modules/async/constant.js
ela-4.0.0 node_modules/async/constant.js
ela-3.4.3 node_modules/async/constant.js
ela-3.4.2 node_modules/async/constant.js
ela-3.4.0 node_modules/async/constant.js
ela-3.3.1 node_modules/async/constant.js