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

filterAsync-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 {filterAsync, delay} from 'rambda'
const list = ['a', 'bc', 'def']const predicate = async(x: string) => { await delay(100)
return x.length % 2 === 0}const predicateWithIndex = async(x: string, i: number) => { await delay(100)
return x.length + i % 2 === 0}
describe('R.filterAsync', () => { it('happy', async() => { const result = await filterAsync(predicate, list) result // $ExpectType string[] }) it('curried', async() => { const result = await filterAsync(predicate)(list) result // $ExpectType string[] }) it('with index', async() => { const result = await filterAsync(predicateWithIndex, list) result // $ExpectType string[] }) it('with index curried', async() => { const result = await filterAsync(predicateWithIndex)(list) result // $ExpectType string[] })})
rambda

Version Info

Tagged at
2 months ago