step/providers/math/math.go
Sasha Koshka adf77c962d providers: Bring math provider back into service
Sprig is missing some float math functions
2024-12-21 02:06:19 -05:00

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)
}