UNPKG

graphql

Version:

A Query Language and Runtime which can target any service.

11 lines 419 B
import { isPromise } from "./isPromise.mjs"; export function promiseReduce(values, callbackFn, initialValue) { let accumulator = initialValue; for (const value of values) { accumulator = isPromise(accumulator) ? accumulator.then((resolved) => callbackFn(resolved, value)) : callbackFn(accumulator, value); } return accumulator; } //# sourceMappingURL=promiseReduce.js.map