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

sortObject-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
import {sortObject} from 'rambda'
const obj = { c: 1, a: 2, b: 3,}
describe('R.sortObjectEvery', () => { it('predicate with all arguments', () => { const result = sortObject((propA, propB, valueA, valueB) => { propA // $ExpectType string propB // $ExpectType string valueA // $ExpectType number valueB // $ExpectType number return propA > propB ? -1 : 1 }, obj)
result // $ExpectType { [keyOutput: string]: number; } })
it('predicate with only property arguments', () => { const result = sortObject((propA, propB) => { propA // $ExpectType string propB // $ExpectType string return propA > propB ? -1 : 1 }, obj)
result // $ExpectType { [keyOutput: string]: number; } })})
describe('R.sortObjectEvery - curried version needs to pass a type', () => { it('predicate with all arguments', () => { const result = sortObject<number>((propA, propB, valueA, valueB) => { propA // $ExpectType string propB // $ExpectType string valueA // $ExpectType number valueB // $ExpectType number return propA > propB ? -1 : 1 })(obj)
result // $ExpectType { [keyOutput: string]: number; } })
it('predicate with only property arguments', () => { const result = sortObject<number>((propA, propB) => { propA // $ExpectType string propB // $ExpectType string return propA > propB ? -1 : 1 })(obj)
result // $ExpectType { [keyOutput: string]: number; } })})
rambda

Version Info

Tagged at
2 months ago