You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Uncaught TypeError: Cannot convert undefined or null to object
at slice (<anonymous>)
at Finance.IRR (finance.self-e3a7ba8fd778d256a438ea068bd511733e341d18b95ce0cda6e89071e7a0edb2.js?body=1:51)
at <anonymous>:1:9
Here:
Finance.prototype.IRR = function(cfs) {
var depth = cfs.depth;
var args = cfs.cashFlow;
var numberOfTries = 1;
// Cash flow values must contain at least one positive value and one negative value
var positive, negative;
Array.prototype.slice.call(args).forEach(function (value) { // <<<<< Right here
if (value > 0) positive = true;
if (value < 0) negative = true;
})
The text was updated successfully, but these errors were encountered:
@SethConnell @noff The example in the README.md for IRR won't work. In the image of the IRR function that noff provided, you see that it wants an object with two keys named "depth" and "cashFlow".
For the sake of familiarity I'll use the numbers given in the readme.
Try finance.IRR({depth: 100, cashFlow:[-500000, 200000, 300000, 200000]}) which outputs (at least in my environment) 18.83 and NOT 18.82 as the example in the readme shows.
I'm not really sure what "depth" is, but from the code, its a limiter on how many times the internal NPV function is ran. For cashFlow it needs to be an array of the integers you want you want to run the function against.
I haven't given this library a good looking at, but just from this function I'd either write your own or go somewhere else. When it comes to financing or other peoples money you want to be 100% accurate and understand what is happening.
The example:
finance.IRR(-500000, 200000, 300000, 200000);
Result:
Here:
The text was updated successfully, but these errors were encountered: