shortcuts/stat/src/utils.go
2024-09-28 22:18:36 +02:00

25 lines
401 B
Go

//go:build js && wasm
// +build js,wasm
package src
import (
"syscall/js"
)
func JSFloatArray(arg js.Value) []float64 {
arr := make([]float64, arg.Length())
for i := 0; i < len(arr); i++ {
arr[i] = arg.Index(i).Float()
}
return arr
}
func JSBoolArray(arg js.Value) []bool {
arr := make([]bool, arg.Length())
for i := 0; i < len(arr); i++ {
arr[i] = arg.Index(i).Bool()
}
return arr
}