// // Copyright 2022 DXOS.org // import { sort } from './sort'; test('sort', () => { const object = { a: 1, c: [1, 2, 3], first: true, b: { y: false, x: [ { num: 1 }, { num: 3 }, { num: 2 } ] } }; const sorted = sort(object, { depth: 2, map: { '.': ['first'], '.b.x': (value: any) => value.num } }); expect(JSON.stringify(sorted)) .toBe('{"first":true,"a":1,"b":{"x":[{"num":1},{"num":2},{"num":3}],"y":false},"c":[1,2,3]}'); });