diff --git a/src/functions.js b/src/functions.js index 3b28e943..c90d2482 100644 --- a/src/functions.js +++ b/src/functions.js @@ -131,8 +131,10 @@ const functions = (() => { arg = arg[0]; } str = JSON.stringify(arg, function (key, val) { - return (typeof val !== 'undefined' && val !== null && val.toPrecision && isNumeric(val)) ? Number(val.toPrecision(15)) : - (val && isFunction(val)) ? '' : val; + if (typeof val !== 'undefined' && val !== null && isNumeric(val)) { + return val.toPrecision && !Number.isInteger(val) ? Number(val.toPrecision(15)) : val; + } + return val && isFunction(val) ? '' : val; }, space); } return str; diff --git a/test/test-suite/groups/function-formatBase/case008.json b/test/test-suite/groups/function-formatBase/case008.json new file mode 100644 index 00000000..df426729 --- /dev/null +++ b/test/test-suite/groups/function-formatBase/case008.json @@ -0,0 +1,6 @@ +{ + "expr": "$formatBase(big_id)", + "data": { "big_id": 5890840712243076 }, + "bindings": {}, + "result": "5890840712243076" +} diff --git a/test/test-suite/groups/function-string/case030.json b/test/test-suite/groups/function-string/case030.json new file mode 100644 index 00000000..b92413c1 --- /dev/null +++ b/test/test-suite/groups/function-string/case030.json @@ -0,0 +1,6 @@ +{ + "expr": "$string(big_id)", + "data": { "big_id": 5890840712243076 }, + "bindings": {}, + "result": "5890840712243076" +}