chorecore
Version:
Utilities to simplify many commonly used pieces of code
15 lines • 475 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.mathFunctions = void 0;
exports.mathFunctions = {
closest: function (needle, arr) {
return arr.reduce(function (a, b) {
return Math.abs(b - needle) < Math.abs(a - needle) ? b : a;
});
},
parseFractionString: function (fraction) {
var split = fraction.split("/");
return +split[0] / +split[1];
}
};
//# sourceMappingURL=math.js.map