29 lines
534 B
Go
29 lines
534 B
Go
package math
|
|
|
|
import "math"
|
|
import "html/template"
|
|
import "git.tebibyte.media/sashakoshka/step"
|
|
|
|
var _ step.FuncProvider = new(Provider)
|
|
|
|
// Provider provides math functions.
|
|
type Provider struct {
|
|
|
|
}
|
|
|
|
// Package fulfills the step.Provider interface.
|
|
func (this *Provider) Package () string {
|
|
return "math"
|
|
}
|
|
|
|
// FuncMap fulfills the step.FuncProvider interface.
|
|
func (this *Provider) FuncMap () template.FuncMap {
|
|
return template.FuncMap {
|
|
"modf": funcModf,
|
|
}
|
|
}
|
|
|
|
func funcModf (a, b float64) float64 {
|
|
return math.Mod(a, b)
|
|
}
|