Get the graph rendering as expected

This commit is contained in:
Oliver-Akins 2025-04-23 00:16:24 -06:00
parent 3796687a72
commit 5e9b91b199
5 changed files with 98 additions and 24 deletions

View file

@ -0,0 +1,19 @@
/**
*
* @param {string | number} a
* @param {string | number} b
*/
export function smallToLarge(a, b) {
const aInt = Number.parseInt(a);
const bInt = Number.parseInt(b);
const aIsInvalid = Number.isNaN(aInt);
const bIsInvalid = Number.isNaN(bInt);
if (aIsInvalid && bIsInvalid) {
return a > b;
} else if (aIsInvalid || bIsInvalid) {
return aIsInvalid ? -1 : 1;
};
return Math.sign(aInt - bInt);
};