roc
Version:
Build modern web applications easily
26 lines (24 loc) • 545 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = onProperty;
/**
* Sorter for an object on a property
*
* @param {string} property - The property to sort on.
*
* @returns {number} - The sort value for that property.
*/
function onProperty(property) {
return (a, b) => {
if (a[property] > b[property]) {
return 1;
}
if (a[property] < b[property]) {
return -1;
}
return 0;
};
}
//# sourceMappingURL=on-property.js.map