fix: convert js nulls to Go zero values

This commit is contained in:
Lea Anthony 2019-03-19 08:20:45 +11:00
commit c5276cca6c
No known key found for this signature in database
GPG key ID: 33DAF7BB90A58405

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
}