Files
bodyshop/client/src/utils/sorters.js
Dave Richer 4eb8faa5d9 - the great reformat
Signed-off-by: Dave Richer <dave@imexsystems.ca>
2024-02-06 18:23:46 -05:00

20 lines
496 B
JavaScript

export function alphaSort(a, b) {
return (a ? a.toLowerCase() : "").localeCompare(b ? b.toLowerCase() : "");
// if (A < B)
// //sort string ascending
// return -1;
// if (A > B) return 1;
// return 0; //default return value (no sorting)
}
export function dateSort(a, b) {
return new Date(a) - new Date(b);
}
export function statusSort(a, b, statusList) {
return (
statusList.findIndex((x) => x === a) - statusList.findIndex((x) => x === b)
);
}