Maps an array asynchronously
Example:
import { asyncMap } "@thalesrc/js-utils/array"; const array = [1, 2, 3]; asyncMap(array, async value => { return await addOneAfterASecond(value); }).then(result => { console.log(result); // [2, 3, 4] });
Example as Array Prototype:
import "@thalesrc/js-utils/array/proto/async-map"; const array = [1, 2, 3]; const result = await array.asyncMap(async value => await addOneAfterASecond(value)); // [2, 3, 4]
Array to map
Callback async function to map the array
A promise contains asynchronusly mapped array result
Generated using TypeDoc
Async Map
Maps an array asynchronously
Example:
import { asyncMap } "@thalesrc/js-utils/array"; const array = [1, 2, 3]; asyncMap(array, async value => { return await addOneAfterASecond(value); }).then(result => { console.log(result); // [2, 3, 4] });
Example as Array Prototype:
import "@thalesrc/js-utils/array/proto/async-map"; const array = [1, 2, 3]; const result = await array.asyncMap(async value => await addOneAfterASecond(value)); // [2, 3, 4]