Breaking changes

1.6.0

removed SortableObject argument in byValues

In this version it's removed definitely the possibility to pass the SortableObject as argument to the byValues function.

import {byNumber, byString, byValues} from "sort-es";

const objsToSort = [
    {id: 2, name: 'teresa'},
    {id: 3, name: 'roberto'},
    {id: 2, name: 'roberto'}
];

// BEFORE

//i sort by THEIR NAMES and THEN by their ids
const sortedObjectBefore = objsToSort.sort(byValues({
    name: byString(),
    id: byNumber()
}));


// AFTER

//i sort by THEIR NAMES and THEN by their ids
const sortedObjectAfter = objsToSort.sort(byValues([
    [(x) => x.name, byString()],
    [(x) => x.id, byNumber()]
]));

change SortableTuple argument in byValues

In this version it's changed the first argument for the SortableTuple type.

import {byNumber, byString, byValues} from "sort-es";

const objsToSort = [
    {id: 2, name: 'teresa'},
    {id: 3, name: 'roberto'},
    {id: 2, name: 'roberto'}
];

// BEFORE

//i sort by THEIR NAMES and THEN by their ids
const sortedObjectBefore = objsToSort.sort(byValues([
    ['name', byString()],
    ['id', byNumber()]
]));


// AFTER

//i sort by THEIR NAMES and THEN by their ids
const sortedObjectAfter = objsToSort.sort(byValues([
    [(x) => x.name, byString()],
    [(x) => x.id, byNumber()]
]));