Server IP : 85.214.239.14 / Your IP : 3.144.26.99 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/3/task/3/root/proc/3/root/lib/node_modules/pm2/node_modules/async/ |
Upload File : |
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _concatLimit = require('./concatLimit.js'); var _concatLimit2 = _interopRequireDefault(_concatLimit); var _awaitify = require('./internal/awaitify.js'); var _awaitify2 = _interopRequireDefault(_awaitify); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Applies `iteratee` to each item in `coll`, concatenating the results. Returns * the concatenated list. The `iteratee`s are called in parallel, and the * results are concatenated as they return. The results array will be returned in * the original order of `coll` passed to the `iteratee` function. * * @name concat * @static * @memberOf module:Collections * @method * @category Collection * @alias flatMap * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`, * which should use an array as its result. Invoked with (item, callback). * @param {Function} [callback] - A callback which is called after all the * `iteratee` functions have finished, or an error occurs. Results is an array * containing the concatenated results of the `iteratee` function. Invoked with * (err, results). * @returns A Promise, if no callback is passed * @example * * // dir1 is a directory that contains file1.txt, file2.txt * // dir2 is a directory that contains file3.txt, file4.txt * // dir3 is a directory that contains file5.txt * // dir4 does not exist * * let directoryList = ['dir1','dir2','dir3']; * let withMissingDirectoryList = ['dir1','dir2','dir3', 'dir4']; * * // Using callbacks * async.concat(directoryList, fs.readdir, function(err, results) { * if (err) { * console.log(err); * } else { * console.log(results); * // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ] * } * }); * * // Error Handling * async.concat(withMissingDirectoryList, fs.readdir, function(err, results) { * if (err) { * console.log(err); * // [ Error: ENOENT: no such file or directory ] * // since dir4 does not exist * } else { * console.log(results); * } * }); * * // Using Promises * async.concat(directoryList, fs.readdir) * .then(results => { * console.log(results); * // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ] * }).catch(err => { * console.log(err); * }); * * // Error Handling * async.concat(withMissingDirectoryList, fs.readdir) * .then(results => { * console.log(results); * }).catch(err => { * console.log(err); * // [ Error: ENOENT: no such file or directory ] * // since dir4 does not exist * }); * * // Using async/await * async () => { * try { * let results = await async.concat(directoryList, fs.readdir); * console.log(results); * // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ] * } catch (err) { * console.log(err); * } * } * * // Error Handling * async () => { * try { * let results = await async.concat(withMissingDirectoryList, fs.readdir); * console.log(results); * } catch (err) { * console.log(err); * // [ Error: ENOENT: no such file or directory ] * // since dir4 does not exist * } * } * */ function concat(coll, iteratee, callback) { return (0, _concatLimit2.default)(coll, Infinity, iteratee, callback); } exports.default = (0, _awaitify2.default)(concat, 3); module.exports = exports.default;