Skip to content

asyncMap<T, U>

Maps over an array asynchronously, applying the provided callback function to each element.

Import:

import { asyncMap } from 'obsidian-dev-utils/async';

Signature:

function asyncMap(arr: T[], callback: (value: T, index: number, array: T[]) => Promisable<U>): Promise<U[]>

Parameters:

ParameterTypeDescription
arrT[]The array to map over.
callback(value: T, index: number, array: T[]) => Promisable<U>The callback function to apply to each element.

Returns: Promise<U[]> — A Promise that resolves with an array of the results of the callback function.