cast/js_export.go

32 lines
585 B
Go
Raw Permalink Normal View History

2026-05-30 17:16:05 +08:00
package cast
import (
"apigo.cc/go/jsmod"
)
func init() {
jsmod.Register("cast", map[string]any{
// JSON
"ToJSON": ToJSON,
"PrettyToJSON": PrettyToJSON,
"FromJSON": func(data any) (any, error) {
2026-05-30 17:16:05 +08:00
var res any
err := UnmarshalJSON(data, &res)
return res, err
},
// Time
"Now": Now,
"ParseTime": ParseTime,
"FormatTime": FormatTime,
"AddTime": AddTime,
"Duration": Duration,
"DescribeDuration": DescribeDuration,
2026-05-30 17:16:05 +08:00
// Logic
"Split": Split,
"SplitArgs": SplitArgs,
"JoinArgs": JoinArgs,
2026-05-30 17:16:05 +08:00
})
}