UNPKG

iopa-bot

Version:

API-First Bot Framework for Internet of Things (IoT), based on Internet of Protocols Alliance (IOPA) specification

15 lines (13 loc) 447 B
export const asyncForEach = async (array, callback) => { for (let index = 0; index < array.length; index++) { await callback(array[index], index, array) } } export const asyncForEachIfTrue = async (array, callback) => { let shouldContinue: boolean = false for (let index = 0; index < array.length; index++) { shouldContinue = await callback(array[index], index, array) if (!shouldContinue) break } return shouldContinue }