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

sortByPath-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
import {sortByPath} from 'rambda'
interface Input { a: {b: number},}
describe('R.sortByPath', () => { it('with string as path', () => { const input: Input[] = [{a: {b: 2}}, {a: {b: 1}}] const result = sortByPath('a.b', input) const curriedResult = sortByPath('a.b')(input)
result // $ExpectType Input[] curriedResult // $ExpectType Input[] result[0].a.b // $ExpectType number }) it('with list of strings as path', () => { const input: Input[] = [{a: {b: 2}}, {a: {b: 1}}] const result = sortByPath(['a', 'b'], input) const curriedResult = sortByPath(['a', 'b'])(input)
result // $ExpectType Input[] curriedResult // $ExpectType Input[] result[0].a.b // $ExpectType number })})
rambda

Version Info

Tagged at
2 months ago