Returns a function that checks if a value is within range of a base value
const tenPercent = isApprox(0.1);
// Check if 101 is within 10% range of 100
tenPercent(100, 101);
Returns a function to check if a value is within range of a base value
const close = isApprox(0.1, 100);
// Check if 101 is within 10% range of 100
close(101);
Returns true/false if value
is within rangePercent
of baseValue
.
isApprox(0.1, 100, 101);
Checks if a value is within range of a base value
Throws an error if range or base values are NaN. If value being checked is NaN or infinity, false is returned.
Param: rangePercent
Param: baseValue
Param: v
Returns