solid-credit
Version:
Solid Credit is an advanced tool designed for the precise generation of loan amortization tables. This library encompasses a variety of loan structures, including the French, German, and American systems, in addition to offering options for grace periods.
24 lines (23 loc) • 606 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomRounding = void 0;
class CustomRounding {
// method public
GetroundUp(num) {
return this.calculateRoundUp(num);
}
// method protected
calculateRoundUp(num) {
let decimalPart = num - Math.floor(num);
if (decimalPart < 0.25) {
return Math.floor(num);
}
else if (decimalPart < 0.75) {
return Math.floor(num) + 0.5;
}
else {
return Math.ceil(num);
}
}
}
exports.CustomRounding = CustomRounding;