Software: Apache. PHP/7.3.33 uname -a: Linux acloudg.aryanict.com 4.18.0-513.9.1.lve.el8.x86_64 #1 SMP Mon Dec 4 15:01:22 UTC uid=1095(katebhospital) gid=1098(katebhospital) groups=1098(katebhospital) Safe-mode: OFF (not secure) /opt/alt/alt-nodejs11/root/usr/lib/node_modules/npm/node_modules.bundled/p-locate/ drwxr-xr-x |
Viewing file: Select action/file-type: 'use strict'; const pLimit = require('p-limit'); class EndError extends Error { constructor(value) { super(); this.value = value; } } // the input can also be a promise, so we `Promise.all()` them both const finder = el => Promise.all(el).then(val => val[1] === true && Promise.reject(new EndError(val[0]))); module.exports = (iterable, tester, opts) => { opts = Object.assign({ concurrency: Infinity, preserveOrder: true }, opts); const limit = pLimit(opts.concurrency); // start all the promises concurrently with optional limit const items = Array.from(iterable).map(el => [el, limit(() => Promise.resolve(el).then(tester))]); // check the promises either serially or concurrently const checkLimit = pLimit(opts.preserveOrder ? 1 : Infinity); return Promise.all(items.map(el => checkLimit(() => finder(el)))) .then(() => {}) .catch(err => err instanceof EndError ? err.value : Promise.reject(err)); }; |
:: Command execute :: | |
--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.0986 ]-- |