From f0525245de2e1eb13674a787e0571f8140827e1c Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Mon, 8 Nov 2021 21:09:06 +0000 Subject: [PATCH] fix: Correct decimal places, rather than rounding to the nearest 0.01 --- lib/findPaths.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/findPaths.js b/lib/findPaths.js index 99879cf..ee71fdd 100644 --- a/lib/findPaths.js +++ b/lib/findPaths.js @@ -10,7 +10,7 @@ let formatLargeOrSmall = num => { }else if(num != 0){ return num.toFixed(-Math.floor(Math.log(num)/Math.log(10))); }else{ - return "~0" + return num//return "~0" } } @@ -75,7 +75,8 @@ function findDistance({sourceElementId, targetElementId, nodes, links}){ } //let sum = JSON.stringify(weights)//weights.length > 0 ? weights.reduce((a,b) => (a+b)) / weights.length : "Not found" //return sum - return weights.map(weight => Math.round(weight*100)/100) + return weights + //return weights.map(weight => Math.round(weight*100)/100) } function findDistancesForAllElements({nodes, links}){