diff --git a/src/module/cytoscapeMap.js b/src/module/cytoscapeMap.js index 85f501d..31e4673 100644 --- a/src/module/cytoscapeMap.js +++ b/src/module/cytoscapeMap.js @@ -42,7 +42,7 @@ const composeFreqTypeText = (baseText, dataLayerOption, optionValue) => { ? baseText + (optionValue * 100).toFixed(2) + "%" : baseText + optionValue.toFixed(2); // Check if the value is an integer; if not, round to 2 decimal places. - text = Math.trunc(optionValue) === optionValue ? textInt : textFloat; + text = Number.isInteger(optionValue) ? textInt : textFloat; return text; }; @@ -148,7 +148,7 @@ export default function cytoscapeMap( // Check if the value is an integer; if not, round to 2 decimal places. textTimeLabel = - Math.trunc(optionValue) === optionValue + Number.isInteger(optionValue) ? timeLabelInt : timeLabelFloat; @@ -223,7 +223,7 @@ export default function cytoscapeMap( // Check if the value is an integer; if not, round to 2 decimal places. result = - Math.trunc(optionValue) === optionValue ? edgeInt : edgeFloat; + Number.isInteger(optionValue) ? edgeInt : edgeFloat; break; case "duration": // Duration: Relative is percentage %, others need time unit conversion. @@ -233,7 +233,7 @@ export default function cytoscapeMap( timeLabelInt = getTimeLabel(optionValue); timeLabelFloat = getTimeLabel(optionValue.toFixed(2)); edgeTimeLabel = - Math.trunc(optionValue) === optionValue + Number.isInteger(optionValue) ? timeLabelInt : timeLabelFloat;