/usr/local/lib/node_modules/pm2/node_modules/@pm2/io/node_modules/async
NameSizeModeActions
dist/-0755rm
internal/-0755rm
all.js16800644editdlrm
allLimit.js15450644editdlrm
allSeries.js12750644editdlrm
any.js17580644editdlrm
anyLimit.js15920644editdlrm
anySeries.js13140644editdlrm
apply.js18430644editdlrm
applyEach.js17790644editdlrm
applyEachSeries.js12850644editdlrm
asyncify.js35000644editdlrm
auto.js98440644editdlrm
autoInject.js64810644editdlrm
bower.json2450644editdlrm
cargo.js46510644editdlrm
CHANGELOG.md293400644editdlrm
compose.js15610644editdlrm
concat.js15880644editdlrm
concatLimit.js21620644editdlrm
concatSeries.js12720644editdlrm
constant.js17600644editdlrm
detect.js22080644editdlrm
detectLimit.js17600644editdlrm
detectSeries.js13530644editdlrm
dir.js12940644editdlrm
doDuring.js21830644editdlrm
doUntil.js13740644editdlrm
doWhilst.js20640644editdlrm
during.js22010644editdlrm
each.js28360644editdlrm
eachLimit.js15680644editdlrm
eachOf.js33680644editdlrm
eachOfLimit.js14180644editdlrm
eachOfSeries.js11370644editdlrm
eachSeries.js12060644editdlrm
ensureAsync.js25150644editdlrm
every.js16800644editdlrm
everyLimit.js15450644editdlrm
everySeries.js12750644editdlrm
filter.js15240644editdlrm
filterLimit.js13440644editdlrm
filterSeries.js12360644editdlrm
find.js22080644editdlrm
findLimit.js17600644editdlrm
findSeries.js13530644editdlrm
foldl.js26760644editdlrm
foldr.js15360644editdlrm
forEach.js28360644editdlrm
forEachLimit.js15680644editdlrm
forEachOf.js33680644editdlrm
forEachOfLimit.js14180644editdlrm
forEachOfSeries.js11370644editdlrm
forEachSeries.js12060644editdlrm
forever.js19410644editdlrm
groupBy.js21310644editdlrm
groupByLimit.js23790644editdlrm
groupBySeries.js13470644editdlrm
index.js195030644editdlrm
inject.js26760644editdlrm
LICENSE10630644editdlrm
log.js11940644editdlrm
map.js20810644editdlrm
mapLimit.js13140644editdlrm
mapSeries.js12090644editdlrm
mapValues.js22410644editdlrm
mapValuesLimit.js20370644editdlrm
mapValuesSeries.js13280644editdlrm
memoize.js32320644editdlrm
nextTick.js14470644editdlrm
package.json24120644editdlrm
parallel.js31000644editdlrm
parallelLimit.js14220644editdlrm
priorityQueue.js31040644editdlrm
queue.js58550644editdlrm
race.js21620644editdlrm
README.md25360644editdlrm
reduce.js26760644editdlrm
reduceRight.js15360644editdlrm
reflect.js23790644editdlrm
reflectAll.js27950644editdlrm
reject.js14480644editdlrm
rejectLimit.js12660644editdlrm
rejectSeries.js11580644editdlrm
retry.js54350644editdlrm
retryable.js20250644editdlrm
select.js15240644editdlrm
selectLimit.js13440644editdlrm
selectSeries.js12360644editdlrm
seq.js29860644editdlrm
series.js29370644editdlrm
setImmediate.js13890644editdlrm
some.js17580644editdlrm
someLimit.js15920644editdlrm
someSeries.js13140644editdlrm
sortBy.js28290644editdlrm
timeout.js27760644editdlrm
times.js14590644editdlrm
timesLimit.js13930644editdlrm
timesSeries.js10210644editdlrm
transform.js27150644editdlrm
tryEach.js25600644editdlrm
unmemoize.js6810644editdlrm
until.js14460644editdlrm
waterfall.js33430644editdlrm
whilst.js21910644editdlrm
wrapSync.js35000644editdlrm
Edit: /usr/local/lib/node_modules/pm2/node_modules/@pm2/io/node_modules/async/autoInject.js (6481B)
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = autoInject; var _auto = require('./auto'); var _auto2 = _interopRequireDefault(_auto); var _baseForOwn = require('lodash/_baseForOwn'); var _baseForOwn2 = _interopRequireDefault(_baseForOwn); var _arrayMap = require('lodash/_arrayMap'); var _arrayMap2 = _interopRequireDefault(_arrayMap); var _isArray = require('lodash/isArray'); var _isArray2 = _interopRequireDefault(_isArray); var _trim = require('lodash/trim'); var _trim2 = _interopRequireDefault(_trim); var _wrapAsync = require('./internal/wrapAsync'); var _wrapAsync2 = _interopRequireDefault(_wrapAsync); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var FN_ARGS = /^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m; var FN_ARG_SPLIT = /,/; var FN_ARG = /(=.+)?(\s*)$/; var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; function parseParams(func) { func = func.toString().replace(STRIP_COMMENTS, ''); func = func.match(FN_ARGS)[2].replace(' ', ''); func = func ? func.split(FN_ARG_SPLIT) : []; func = func.map(function (arg) { return (0, _trim2.default)(arg.replace(FN_ARG, '')); }); return func; } /** * A dependency-injected version of the [async.auto]{@link module:ControlFlow.auto} function. Dependent * tasks are specified as parameters to the function, after the usual callback * parameter, with the parameter names matching the names of the tasks it * depends on. This can provide even more readable task graphs which can be * easier to maintain. * * If a final callback is specified, the task results are similarly injected, * specified as named parameters after the initial error parameter. * * The autoInject function is purely syntactic sugar and its semantics are * otherwise equivalent to [async.auto]{@link module:ControlFlow.auto}. * * @name autoInject * @static * @memberOf module:ControlFlow * @method * @see [async.auto]{@link module:ControlFlow.auto} * @category Control Flow * @param {Object} tasks - An object, each of whose properties is an {@link AsyncFunction} of * the form 'func([dependencies...], callback). The object's key of a property * serves as the name of the task defined by that property, i.e. can be used * when specifying requirements for other tasks. * * The `callback` parameter is a `callback(err, result)` which must be called * when finished, passing an `error` (which can be `null`) and the result of * the function's execution. The remaining parameters name other tasks on * which the task is dependent, and the results from those tasks are the * arguments of those parameters. * @param {Function} [callback] - An optional callback which is called when all * the tasks have been completed. It receives the `err` argument if any `tasks` * pass an error to their callback, and a `results` object with any completed * task results, similar to `auto`. * @example * * // The example from `auto` can be rewritten as follows: * async.autoInject({ * get_data: function(callback) { * // async code to get some data * callback(null, 'data', 'converted to array'); * }, * make_folder: function(callback) { * // async code to create a directory to store a file in * // this is run at the same time as getting the data * callback(null, 'folder'); * }, * write_file: function(get_data, make_folder, callback) { * // once there is some data and the directory exists, * // write the data to a file in the directory * callback(null, 'filename'); * }, * email_link: function(write_file, callback) { * // once the file is written let's email a link to it... * // write_file contains the filename returned by write_file. * callback(null, {'file':write_file, 'email':'user@example.com'}); * } * }, function(err, results) { * console.log('err = ', err); * console.log('email_link = ', results.email_link); * }); * * // If you are using a JS minifier that mangles parameter names, `autoInject` * // will not work with plain functions, since the parameter names will be * // collapsed to a single letter identifier. To work around this, you can * // explicitly specify the names of the parameters your task function needs * // in an array, similar to Angular.js dependency injection. * * // This still has an advantage over plain `auto`, since the results a task * // depends on are still spread into arguments. * async.autoInject({ * //... * write_file: ['get_data', 'make_folder', function(get_data, make_folder, callback) { * callback(null, 'filename'); * }], * email_link: ['write_file', function(write_file, callback) { * callback(null, {'file':write_file, 'email':'user@example.com'}); * }] * //... * }, function(err, results) { * console.log('err = ', err); * console.log('email_link = ', results.email_link); * }); */ function autoInject(tasks, callback) { var newTasks = {}; (0, _baseForOwn2.default)(tasks, function (taskFn, key) { var params; var fnIsAsync = (0, _wrapAsync.isAsync)(taskFn); var hasNoDeps = !fnIsAsync && taskFn.length === 1 || fnIsAsync && taskFn.length === 0; if ((0, _isArray2.default)(taskFn)) { params = taskFn.slice(0, -1); taskFn = taskFn[taskFn.length - 1]; newTasks[key] = params.concat(params.length > 0 ? newTask : taskFn); } else if (hasNoDeps) { // no dependencies, use the function as-is newTasks[key] = taskFn; } else { params = parseParams(taskFn); if (taskFn.length === 0 && !fnIsAsync && params.length === 0) { throw new Error("autoInject task functions require explicit parameters."); } // remove callback param if (!fnIsAsync) params.pop(); newTasks[key] = params.concat(newTask); } function newTask(results, taskCb) { var newArgs = (0, _arrayMap2.default)(params, function (name) { return results[name]; }); newArgs.push(taskCb); (0, _wrapAsync2.default)(taskFn).apply(null, newArgs); } }); (0, _auto2.default)(newTasks, callback); } module.exports = exports['default'];