@@ -30,7 +30,7 @@ func FuncToJS(c *Context, v any) (_ *Value, err error) {
3030 }
3131
3232 if rtype .Kind () != reflect .Func {
33- return nil , newInvalidGoTargetErr ("function" , v )
33+ return nil , newInvalidGoTypeErr ("function" , v )
3434 }
3535
3636 if rval .IsNil () {
@@ -114,7 +114,7 @@ func handlePointerArgument(jsArg *Value, argType reflect.Type) (reflect.Value, e
114114 underlyingType := argType .Elem ()
115115 zeroVal := reflect .New (underlyingType ).Elem ()
116116
117- goVal , err := JsValueToGo (jsArg , zeroVal .Interface ())
117+ goVal , err := ToGoValue (jsArg , zeroVal .Interface ())
118118 if err != nil {
119119 return reflect.Value {}, newJsToGoErr (jsArg , err , "function param pointer to " + jsArg .Type ())
120120 }
@@ -184,7 +184,7 @@ func JsArgToGo(jsArg *Value, argType reflect.Type) (reflect.Value, error) {
184184
185185 goZeroVal := CreateNonNilSample (argType )
186186
187- goVal , err := JsValueToGo (jsArg , goZeroVal )
187+ goVal , err := ToGoValue (jsArg , goZeroVal )
188188 if err != nil {
189189 return reflect.Value {}, newJsToGoErr (jsArg , err , "function param " + jsArg .Type ())
190190 }
@@ -241,7 +241,7 @@ func GoFuncResultToJs(c *Context, results []reflect.Value) (*Value, error) {
241241
242242 // Single remaining value -> return that value
243243 if len (remaining ) == 1 {
244- return ToJSValue (c , remaining [0 ].Interface ())
244+ return ToJsValue (c , remaining [0 ].Interface ())
245245 }
246246
247247 // Multiple remaining values -> return as JS array
@@ -250,12 +250,12 @@ func GoFuncResultToJs(c *Context, results []reflect.Value) (*Value, error) {
250250 jsValues [i ] = result .Interface ()
251251 }
252252
253- return ToJSValue (c , jsValues )
253+ return ToJsValue (c , jsValues )
254254 }
255255
256256 // Single return value -> return that value
257257 if len (results ) == 1 {
258- return ToJSValue (c , results [0 ].Interface ())
258+ return ToJsValue (c , results [0 ].Interface ())
259259 }
260260
261261 // Multiple return values -> return as JS array
@@ -264,5 +264,5 @@ func GoFuncResultToJs(c *Context, results []reflect.Value) (*Value, error) {
264264 jsValues [i ] = result .Interface ()
265265 }
266266
267- return ToJSValue (c , jsValues )
267+ return ToJsValue (c , jsValues )
268268}
0 commit comments