feat: register rand package to jsmod
This commit is contained in:
parent
36501bd5ff
commit
c54df23b45
2
go.mod
2
go.mod
@ -1,3 +1,5 @@
|
||||
module apigo.cc/go/rand
|
||||
|
||||
go 1.25.0
|
||||
|
||||
require apigo.cc/go/jsmod v1.0.0
|
||||
|
||||
2
go.sum
Normal file
2
go.sum
Normal file
@ -0,0 +1,2 @@
|
||||
apigo.cc/go/jsmod v1.0.0 h1:lVQMq0tCno4kbHlQ3j5wzsm+v24J+bznIoHxpton0pE=
|
||||
apigo.cc/go/jsmod v1.0.0/go.mod h1:bmyeZtOAP/j5am+YRnaiM89smysK24K7ebk0koFtsSw=
|
||||
25
js_export.go
Normal file
25
js_export.go
Normal file
@ -0,0 +1,25 @@
|
||||
package rand
|
||||
|
||||
import (
|
||||
"apigo.cc/go/jsmod"
|
||||
)
|
||||
|
||||
func init() {
|
||||
jsmod.Register("rand", map[string]any{
|
||||
"int": func(min, max int64) int64 {
|
||||
return Int(min, max)
|
||||
},
|
||||
"fastInt": func(min, max int64) int64 {
|
||||
return FastInt(min, max)
|
||||
},
|
||||
"float": func(min, max float64) float64 {
|
||||
return Float(min, max)
|
||||
},
|
||||
"fastFloat": func(min, max float64) float64 {
|
||||
return FastFloat(min, max)
|
||||
},
|
||||
"byte": Byte,
|
||||
"bytes": Bytes,
|
||||
"perm": Perm,
|
||||
})
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user