Skip to content

Commit f27a4b0

Browse files
author
Miyo Sho
committed
Fix object / array empty inputs
1 parent 0651e62 commit f27a4b0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/compiler/jsgen.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class ConstantInput {
177177
}
178178

179179
asString () {
180-
return `"${sanitize('' + this.constantValue)}"`; // Should this be updated to use "Cast.toString"?
180+
return `"${sanitize(Cast.toString(this.constantValue))}"`;
181181
}
182182

183183
asBoolean () {
@@ -205,6 +205,8 @@ class ConstantInput {
205205
}
206206

207207
asUnknown () {
208+
if (Array.isArray(this.constantValue)) return this.asArray();
209+
if (typeof this.constantValue === 'object') return this.asObject();
208210
// Attempt to convert strings to numbers if it is unlikely to break things
209211
if (typeof this.constantValue === 'number') {
210212
// todo: handle NaN?

0 commit comments

Comments
 (0)