fix: convert js nulls to Go zero values

This commit is contained in:
Lea Anthony
2019-03-19 08:20:45 +11:00
parent 74dbbbed8a
commit c5276cca6c

View File

@@ -153,8 +153,11 @@ func (b *boundFunction) setInputValue(index int, typ reflect.Type, val interface
}
}()
// Do the conversion
result = reflect.ValueOf(val).Convert(typ)
// Translate javascript null values
if val == nil {
result = reflect.Zero(typ)
} else {
result = reflect.ValueOf(val).Convert(typ)
}
return result, err
}