Helpers
(rt *goja.Runtime, obj *goja.Object)
| 344 | /// Helpers |
| 345 | |
| 346 | func isJsArray(rt *goja.Runtime, obj *goja.Object) (bool, error) { |
| 347 | arrayConstructor := rt.Get("Array") |
| 348 | if arrayConstructor == nil { |
| 349 | return false, nil |
| 350 | } |
| 351 | isArrayFn, ok := goja.AssertFunction(arrayConstructor.ToObject(rt).Get("isArray")) |
| 352 | if !ok { |
| 353 | return false, nil |
| 354 | } |
| 355 | result, err := isArrayFn(goja.Undefined(), obj) |
| 356 | if err != nil { |
| 357 | return false, err |
| 358 | } |
| 359 | return result.ToBoolean(), nil |
| 360 | } |
| 361 | |
| 362 | func extractCommandBuilder(val goja.Value) *jsCommandBuilder { |
| 363 | if goja.IsUndefined(val) || goja.IsNull(val) { |
no test coverage detected