deno.land / x / rambda@v9.1.1 / source / mapParallelAsync-spec.ts

mapParallelAsync-spec.ts
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import {mapParallelAsync, delay} from 'rambda'
const list = ['a', 'bc', 'def']const fn = async(x: string) => { await delay(100)
return x.length % 2 ? x.length + 1 : x.length + 10}const fnWithIndex = async(x: string, i: number) => { await delay(100)
return (x.length + i) % 2 ? x.length + 1 : x.length + 10}
describe('R.mapParallelAsync', () => { it('happy', async() => { const result = await mapParallelAsync(fn, list) result // $ExpectType number[] }) it('curried', async() => { const result = await mapParallelAsync(fn)(list) result // $ExpectType number[] }) it('with index', async() => { const result = await mapParallelAsync(fnWithIndex, list) result // $ExpectType number[] }) it('with index curried', async() => { const result = await mapParallelAsync(fnWithIndex)(list) result // $ExpectType number[] })})
rambda

Version Info

Tagged at
2 months ago