@prelude/cmp
Version:
Cmp module.
12 lines • 331 B
JavaScript
/**
* Number comparision function.
* @throws {@link TypeError} if `a` or `b` are {@link NaN}.
*/
const number = (a, b) => {
if (isNaN(a) || isNaN(b)) {
throw new TypeError('Expected number, got NaN.');
}
return ((a > b ? 1 : 0) - (b > a ? 1 : 0));
};
export default number;
//# sourceMappingURL=number.js.map