module.exports.calculateScaleFactor = calculateScaleFactor;

function calculateScaleFactor(min, max, value) {
  var delta = max - min;
  var scaleFactor = (value - min) / delta;

  scaleFactor = Math.min(scaleFactor, 1);
  scaleFactor = Math.max(scaleFactor, 0);

  return scaleFactor;
}

@@ -103,16 +103,83 @@
 alue) %7B%0A
+  if (max %3C= min) %7B%0A    throw new Error('max must be %3E min');%0A  %7D%0A%0A
   var de

make tests pass for error scenario