nav tabs on admin dashboard

This commit is contained in:
2019-03-07 00:20:34 -06:00
parent f73d6ae228
commit e4f473f376
11661 changed files with 216240 additions and 1544253 deletions
+8 -5
View File
@@ -8,7 +8,10 @@ class EndError extends Error {
}
}
// the input can also be a promise, so we `Promise.all()` them both
// The input can also be a promise, so we `Promise.resolve()` it
const testElement = (el, tester) => Promise.resolve(el).then(tester);
// 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) => {
@@ -19,13 +22,13 @@ module.exports = (iterable, tester, 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))]);
// Start all the promises concurrently with optional limit
const items = [...iterable].map(el => [el, limit(testElement, el, tester)]);
// check the promises either serially or concurrently
// Check the promises either serially or concurrently
const checkLimit = pLimit(opts.preserveOrder ? 1 : Infinity);
return Promise.all(items.map(el => checkLimit(() => finder(el))))
return Promise.all(items.map(el => checkLimit(finder, el)))
.then(() => {})
.catch(err => err instanceof EndError ? err.value : Promise.reject(err));
};