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

unless-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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import {unless, inc} from 'rambda'
describe('R.unless', () => { it('happy', () => { const fn = unless(x => x > 5, inc) const result = fn(1) result // $ExpectType number }) it('with one explicit type', () => { const result = unless( x => { x // $ExpectType number return x > 5 }, x => { x // $ExpectType number return x + 1 }, 1 ) result // $ExpectType number }) it('with two different explicit types', () => { const result = unless( x => { x // $ExpectType number return x > 5 }, x => { x // $ExpectType number return `${x}-foo` }, 1 ) result // $ExpectType string | number })})
describe('R.unless - curried', () => { it('happy', () => { const fn = unless(x => x > 5, inc) const result = fn(1) result // $ExpectType number }) it('with one explicit type', () => { const fn = unless<number>( x => { x // $ExpectType number return x > 5 }, x => { x // $ExpectType number return x + 1 } ) const result = fn(1) result // $ExpectType number }) it('with two different explicit types', () => { const fn = unless<number, string>( x => { x // $ExpectType number return x > 5 }, x => { x // $ExpectType number return `${x}-foo` } ) const result = fn(1) result // $ExpectType string | number })})
rambda

Version Info

Tagged at
2 months ago