File: //proc/thread-self/root/opt/code/src/util.js
export function strCompare(a,b)
{
if(a==null) return 1;
else if(b==null) return -1;
var la = a.length, lb = b.length;
if(typeof a == "Number" && typeof b == "Number") return a - b;
if(a.match(/^[+\-]?[0-9]+(\.[0-9]+)?$/) && b.match(/^[+\-]?[0-9]+(\.[0-9]+)?$/)) return a - b;
if(a < b) return -1;
else if(a > b) return 1;
else return 0;
}
export function round(number, precision = 2)
{
const factor = 10 ** precision;
return Math.round(number * factor) / factor;
}