UNPKG

@serenity-js/core

Version:

The core Serenity/JS framework, providing the Screenplay Pattern interfaces, as well as the test reporting and integration infrastructure

14 lines 452 B
/** * Maps an Array<Item_Type> to an Array<Result_Type>, one element at a time. * * @param items * @param mappingFunction */ export function asyncMap(items, mappingFunction) { return Promise.resolve().then(() => items.reduce((previous, item) => previous.then(async (acc) => { const result = await mappingFunction(item); acc.push(result); return acc; }), Promise.resolve([]))); } //# sourceMappingURL=asyncMap.js.map