MCPcopy Index your code
hub / github.com/code-pushup/cli / asyncSequential

Function asyncSequential

packages/utils/src/lib/promises.ts:17–30  ·  view source on GitHub ↗
(
  items: TInput[],
  work: (item: TInput, index: number) => Promise<TOutput>,
)

Source from the content-addressed store, hash-verified

15}
16
17export async function asyncSequential<TInput, TOutput>(
18 items: TInput[],
19 work: (item: TInput, index: number) => Promise<TOutput>,
20): Promise<TOutput[]> {
21 // for-loop used instead of reduce for performance
22 const results: TOutput[] = [];
23 // eslint-disable-next-line functional/no-loop-statements
24 for (const [index, item] of items.entries()) {
25 const result = await work(item, index);
26 // eslint-disable-next-line functional/immutable-data
27 results.push(result);
28 }
29 return results;
30}
31
32export async function settlePromise<T>(
33 promise: Promise<T>,

Callers 13

executePluginsFunction · 0.90
promptPluginOptionsFunction · 0.90
runSetupWizardFunction · 0.90
createRunnerFunctionFunction · 0.90
runProjectsIndividuallyFunction · 0.90
loadProjectEnvsFunction · 0.90
compareManyProjectsFunction · 0.90
collectPreviousReportsFunction · 0.90
createRunnerFunctionFunction · 0.90
loadRulesForLegacyConfigFunction · 0.90
processAuditFunction · 0.90
createRunnerFunctionFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected