deno.land / x / rambda@v9.1.1 / source / filterAsync-spec.ts
123456789101112131415161718192021222324252627282930313233import {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[] })})
Version Info