Skip to content
Snippets Groups Projects

Make JsToJson return valid JSON when the Javascript value is undefined

Merged Jono Wenger requested to merge jono/jsToJsonUndefinedFix into release
2 files
+ 20
0
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 4
0
@@ -32,6 +32,10 @@ func CopyBytesToJS(src []byte) js.Value {
// JsToJson converts the Javascript value to JSON.
func JsToJson(value js.Value) string {
if value.IsUndefined() {
return "null"
}
return JSON.Call("stringify", value).String()
}
Loading