It's beautiful and genuine
Here's a more flexible version, which allows you to create reusable sort functions, and sort by any field.
const sort_by = (field, reverse, primer) => {
const key = primer ?
function(x) {
return primer(x[field])
} :
function(x) {
return x[field]
};
reverse = !reverse ?
…
Top comments (0)