@nozbe/watermelondb
Version:
Build powerful React Native and React web apps that scale from hundreds to tens of thousands of records and remain fast
18 lines (17 loc) • 329 B
JavaScript
;
exports.__esModule = true;
exports.default = sortBy;
function sortBy(sorter, list) {
var clone = list.slice();
var a;
var b;
return clone.sort(function (left, right) {
a = sorter(left);
b = sorter(right);
if (a === b) {
return 0;
}
// $FlowFixMe
return a < b ? -1 : 1;
});
}