Files
klz-cables.com/.pnpm-store/v10/files/3a/e93e3d0f3f33346fa43a191e4266a75ada8a4b79eeddbb3a11c2c6513624ecb0e284a60a79ebb71a08ca9d3e523b4eaff24d060b3a1b23facff70c514b09ac
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

28 lines
759 B
Plaintext

'use strict';
Object.defineProperty(exports, '__esModule', {
value: true,
});
exports.promiseReduce = promiseReduce;
var _isPromise = require('./isPromise.js');
/**
* Similar to Array.prototype.reduce(), however the reducing callback may return
* a Promise, in which case reduction will continue after each promise resolves.
*
* If the callback does not return a Promise, then this function will also not
* return a Promise.
*/
function promiseReduce(values, callbackFn, initialValue) {
let accumulator = initialValue;
for (const value of values) {
accumulator = (0, _isPromise.isPromise)(accumulator)
? accumulator.then((resolved) => callbackFn(resolved, value))
: callbackFn(accumulator, value);
}
return accumulator;
}