fast-json-stringify 5.6.1 → 5.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/serializer.js +1 -1
- package/package.json +1 -1
- package/test/integer.test.js +1 -0
package/lib/serializer.js
CHANGED
|
@@ -27,7 +27,7 @@ module.exports = class Serializer {
|
|
|
27
27
|
if (i === Infinity || i === -Infinity) {
|
|
28
28
|
throw new Error(`The value "${i}" cannot be converted to an integer.`)
|
|
29
29
|
}
|
|
30
|
-
if ((i
|
|
30
|
+
if (Number.isInteger(i)) {
|
|
31
31
|
return '' + i
|
|
32
32
|
}
|
|
33
33
|
if (Number.isNaN(i)) {
|
package/package.json
CHANGED
package/test/integer.test.js
CHANGED
|
@@ -45,6 +45,7 @@ test('render a float as an integer', (t) => {
|
|
|
45
45
|
{ input: 42, output: '42' },
|
|
46
46
|
{ input: 1.99999, output: '1' },
|
|
47
47
|
{ input: -45.05, output: '-45' },
|
|
48
|
+
{ input: 3333333333333333, output: '3333333333333333' },
|
|
48
49
|
{ input: Math.PI, output: '3', rounding: 'trunc' },
|
|
49
50
|
{ input: 5.0, output: '5', rounding: 'trunc' },
|
|
50
51
|
{ input: null, output: '0', rounding: 'trunc' },
|