Replace Math.trunc integer check with Number.isInteger
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user