@prestamype/financial-functions
Version:
Implementación de funciones financieras
34 lines (28 loc) • 596 B
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.main = main;
exports.tcea = tcea;
exports.tir = void 0;
var _tir = require("../_lib/tir.js");
function wrapFun(fn) {
return function (...args) {
return new Promise(resolve => setTimeout(() => {
return resolve(fn(...args));
}, 0));
};
}
function tcea(tir) {
return Math.pow(1 + tir, 12) - 1;
}
var tir_async = wrapFun(_tir.bisection);
exports.tir = tir_async;
async function main(flow) {
var tir = await tir_async(flow);
return {
tir,
tcea: tcea(tir),
tcem: tir
};
}
;