From 9a3d19f53c8fd6d6fe1120b21ac62ab606a9d945 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Mon, 9 Mar 2026 14:20:22 +0800 Subject: [PATCH] Replace Math.trunc integer check with Number.isInteger Co-Authored-By: Claude Opus 4.6 --- src/module/cytoscapeMap.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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;