deno.land / x / rambda@v9.1.1 / source / sortByPath-spec.ts
123456789101112131415161718192021222324252627import {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 })})
Version Info