13 lines
281 B
JavaScript
13 lines
281 B
JavaScript
export const serializeFloat = (value) => {
|
|
if (value !== value) {
|
|
return "NaN";
|
|
}
|
|
switch (value) {
|
|
case Infinity:
|
|
return "Infinity";
|
|
case -Infinity:
|
|
return "-Infinity";
|
|
default:
|
|
return value;
|
|
}
|
|
};
|