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 * 100).toFixed(2) + "%"
|
||||||
: baseText + optionValue.toFixed(2);
|
: baseText + optionValue.toFixed(2);
|
||||||
// Check if the value is an integer; if not, round to 2 decimal places.
|
// 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;
|
return text;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -148,7 +148,7 @@ export default function cytoscapeMap(
|
|||||||
|
|
||||||
// Check if the value is an integer; if not, round to 2 decimal places.
|
// Check if the value is an integer; if not, round to 2 decimal places.
|
||||||
textTimeLabel =
|
textTimeLabel =
|
||||||
Math.trunc(optionValue) === optionValue
|
Number.isInteger(optionValue)
|
||||||
? timeLabelInt
|
? timeLabelInt
|
||||||
: timeLabelFloat;
|
: timeLabelFloat;
|
||||||
|
|
||||||
@@ -223,7 +223,7 @@ export default function cytoscapeMap(
|
|||||||
|
|
||||||
// Check if the value is an integer; if not, round to 2 decimal places.
|
// Check if the value is an integer; if not, round to 2 decimal places.
|
||||||
result =
|
result =
|
||||||
Math.trunc(optionValue) === optionValue ? edgeInt : edgeFloat;
|
Number.isInteger(optionValue) ? edgeInt : edgeFloat;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "duration": // Duration: Relative is percentage %, others need time unit conversion.
|
case "duration": // Duration: Relative is percentage %, others need time unit conversion.
|
||||||
@@ -233,7 +233,7 @@ export default function cytoscapeMap(
|
|||||||
timeLabelInt = getTimeLabel(optionValue);
|
timeLabelInt = getTimeLabel(optionValue);
|
||||||
timeLabelFloat = getTimeLabel(optionValue.toFixed(2));
|
timeLabelFloat = getTimeLabel(optionValue.toFixed(2));
|
||||||
edgeTimeLabel =
|
edgeTimeLabel =
|
||||||
Math.trunc(optionValue) === optionValue
|
Number.isInteger(optionValue)
|
||||||
? timeLabelInt
|
? timeLabelInt
|
||||||
: timeLabelFloat;
|
: timeLabelFloat;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user