add helpers

This commit is contained in:
vedhavyas committed 2019-08-23 10:19:32 -07:00
1 parent 801fd37d20
commit f6ac4e734a
5 files changed
+40 -3

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
// +build js,wasm
package converts
import "syscall/js"
func ToBytes(v js.Value) []byte {
buf := make([]byte, v.Length(), v.Length())
for i := 0; i < v.Length(); i++ {
buf[i] = byte(v.Index(i).Int())
}
return buf
}