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

mapParallelAsyncWithLimit-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
34
35
36
37
38
import {mapParallelAsyncWithLimit, delay} from 'rambda'
const list = ['a', 'bc', 'def']const limit = 3const 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.mapParallelAsyncWithLimit', () => { it('happy', async() => { const result = await mapParallelAsyncWithLimit(fn, limit, list) result // $ExpectType number[] }) it('with index', async() => { const result = await mapParallelAsyncWithLimit(fnWithIndex, limit, list) result // $ExpectType number[] })})
describe('curried', () => { it('happy', async() => { const result = await mapParallelAsyncWithLimit(fn, limit)(list) result // $ExpectType number[] }) it('with index', async() => { const result = await mapParallelAsyncWithLimit(fnWithIndex, limit)(list) result // $ExpectType number[] })})
rambda

Version Info

Tagged at
2 months ago