Skip to content

Commit b9c768b

Browse files
andrew-colemanmattbaileyuk
authored andcommitted
unpack outer wrapper in $string()
Signed-off-by: andrew-coleman <[email protected]>
1 parent 17c65e3 commit b9c768b

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/functions.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ const functions = (() => {
126126
};
127127
} else {
128128
var space = prettify ? 2 : 0;
129+
if(Array.isArray(arg) && arg.outerWrapper) {
130+
arg = arg[0];
131+
}
129132
str = JSON.stringify(arg, function (key, val) {
130133
return (typeof val !== 'undefined' && val !== null && val.toPrecision && isNumeric(val)) ? Number(val.toPrecision(15)) :
131134
(val && isFunction(val)) ? '' : val;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"expr": "$string()",
3+
"data": [4, true],
4+
"bindings": {},
5+
"result": "[4,true]"
6+
}

0 commit comments

Comments
 (0)