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

tryCatchAsync-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
import {delay, tryCatchAsync} from 'rambda'
const fn = async(x: number) => { await delay(100) JSON.parse('{a:') return x + 1}
describe('R.tryCatchAsync', () => { it('fallback is value', async() => { const result = await tryCatchAsync(fn, 1)(1)
result // $ExpectType number }) it('fallback is async', async() => { const fallback = async(x: number) => { await delay(100) return x + 1 } const result = await tryCatchAsync(fn, fallback)(1)
result // $ExpectType number })})
rambda

Version Info

Tagged at
2 months ago