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

sortByPath.spec.js
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { sortByPath } from './sortByPath.js'
const list = [ { a : { b : 3 } }, { a : { b : 1 } }, { a : { b : 2 } } ]const sorted = [ { a : { b : 1 } }, { a : { b : 2 } }, { a : { b : 3 } } ]
test('with string as path', () => { expect(sortByPath('a.b', list)).toEqual(sorted)})
test('with list of strings as path', () => { expect(sortByPath([ 'a', 'b' ], list)).toEqual(sorted)})
test('with string as path - curried', () => { expect(sortByPath('a.b')(list)).toEqual(sorted)})
test('with list of strings as path - curried', () => { expect(sortByPath([ 'a', 'b' ])(list)).toEqual(sorted)})
rambda

Version Info

Tagged at
2 months ago