From 530589bbc000c0849d191326c4d7910750262cc0 Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Thu, 25 Nov 2021 16:13:38 +0000 Subject: [PATCH] tweak --- lib/findPaths.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/findPaths.js b/lib/findPaths.js index e1b7beb..605956e 100644 --- a/lib/findPaths.js +++ b/lib/findPaths.js @@ -81,6 +81,19 @@ function findDistancesForAllElements({nodes, links}){ return distances } +function abridgeArrayAndDisplay(array){ + let newArray + if(array.length > 10){ + newArray = array.slice(0,10) + newArray[11] = "..." + }else{ + newArray=array + } + let formatForDisplay= newArray.map(d => formatLargeOrSmall(d)) + let result = JSON.stringify(formatForDisplay, null, 2).replaceAll(`"`, "") + return result +} + export function CreateTableWithDistances({isListOrdered, orderedList, listOfElements, links}){ if(!isListOrdered || orderedList.length < listOfElements.length){ return (
{""}
) @@ -110,7 +123,7 @@ export function CreateTableWithDistances({isListOrdered, orderedList, listOfElem     {row.name}     - {JSON.stringify(row.distances.map(d => formatLargeOrSmall(d)), null, 2).replaceAll(`"`, "")} + {abridgeArrayAndDisplay(row.distances)}     {formatLargeOrSmall(avg(row.distances))}