From 18b59b28a5f67f9e87e7c88b13c9371109e32ad0 Mon Sep 17 00:00:00 2001 From: andrew-coleman Date: Wed, 26 Feb 2020 08:06:51 +0000 Subject: [PATCH] unpack outer wrapper in $string() Signed-off-by: andrew-coleman --- src/functions.js | 3 +++ test/test-suite/groups/function-string/case029.json | 6 ++++++ 2 files changed, 9 insertions(+) create mode 100644 test/test-suite/groups/function-string/case029.json diff --git a/src/functions.js b/src/functions.js index 39b7195e..e64d5ef3 100644 --- a/src/functions.js +++ b/src/functions.js @@ -126,6 +126,9 @@ const functions = (() => { }; } else { var space = prettify ? 2 : 0; + if(Array.isArray(arg) && arg.outerWrapper) { + 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; diff --git a/test/test-suite/groups/function-string/case029.json b/test/test-suite/groups/function-string/case029.json new file mode 100644 index 00000000..8423744e --- /dev/null +++ b/test/test-suite/groups/function-string/case029.json @@ -0,0 +1,6 @@ +{ + "expr": "$string()", + "data": [4, true], + "bindings": {}, + "result": "[4,true]" +}