Commit eef2a54e by Tomas Dvorak

Math.max.apply replaced by reduce - RangeError (#93) fixed.

parent 536f19b0
...@@ -281,7 +281,7 @@ if($outputFormat === 'json') { ...@@ -281,7 +281,7 @@ if($outputFormat === 'json') {
return res !== null ? res[1].length : 1; return res !== null ? res[1].length : 1;
}; };
var maxDigits = Math.max.apply(null, varietyResults.map(function(value){return significantDigits(value.percentContaining);})); var maxDigits = varietyResults.map(function(value){return significantDigits(value.percentContaining);}).reduce(function(acc,val){return acc>val?acc:val;});
varietyResults.forEach(function(key) { varietyResults.forEach(function(key) {
table.push([key._id.key, key.value.types.toString(), key.totalOccurrences.toString(), key.percentContaining.toFixed(maxDigits).toString()]); table.push([key._id.key, key.value.types.toString(), key.totalOccurrences.toString(), key.percentContaining.toFixed(maxDigits).toString()]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment