README
Array Async
Installation
npm install --save rescript-types-array-async
Summary
let arr = [1, 2, 3]
let asyncFn = (n: int) => {
Console.log(n)
Promise.resolve(n+1)
}
// With Promise.all Console.log will not output the array items in order
let resultAll = Promise.all(arr->Array.map(asyncFn))
// -> result: [2, 3, 4]
// -> stdout: [2, 4, 3]
// With ArrayAsync.map will output the array items in order
let result = ArrayAsync.map(arr, asyncFn)
// -> result: [2, 3, 4]
// -> stdout: [2, 3, 4]
Details
Files were exported from https://codeberg.org/lil5/rescript-reasonably-typed/src/branch/main/types/array-async.