mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 06:39:48 +00:00
7 lines
228 B
JavaScript
7 lines
228 B
JavaScript
export default async function findAsync(arr, asyncCallback) {
|
|
const promises = arr.map(asyncCallback);
|
|
const results = await Promise.all(promises);
|
|
const index = results.findIndex(result => result);
|
|
return arr[index];
|
|
}
|