Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const regressionGenerator = (function(regressionType) {
switch (regressionType) {
case RegressionTypes.LINEAR:
return regressionLinear()
.x(d => d.x)
.y(d => d.y)
.domain([3, d3.max(data, item => item.x)]);
case RegressionTypes.POWER_LAW:
default:
data = data.filter(d => d.y > 0);
return regressionPow()
.x(d => d.x)
.y(d => d.y)
.domain([3, d3.max(data, item => item.x)]);
}
})(regressionType);