tamda
Version:
Practical functional programming library for TypeScript
23 lines • 467 B
JavaScript
/**
* Compares two values, `a` and `b`, on equality, greater than or lesser than.
* @returns
* - 1 if `a > b`
* - -1 if `b > a`
* - 0 otherwise
*/
export function compareValue(a, b) {
if (a == null) {
if (b == null) {
return 0;
}
return -1;
}
if (b == null || a > b) {
return 1;
}
if (a < b) {
return -1;
}
return 0;
}
//# sourceMappingURL=compareValue.js.map