Initial commit

This commit is contained in:
2024-12-05 13:15:22 -05:00
commit 91e72ac49e
17 changed files with 1517 additions and 0 deletions

40
providers/math/math.go Normal file
View File

@@ -0,0 +1,40 @@
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 {
}
// FuncMap fulfills the step.FuncProvider interface.
func (this *Provider) FuncMap () template.FuncMap {
return template.FuncMap {
"add": funcAdd,
"sub": funcSub,
"mul": funcMul,
"div": funcDiv,
"pow": math.Pow,
"sqrt": math.Sqrt,
}
}
func funcAdd (a, b float64) float64 {
return a + b
}
func funcSub (a, b float64) float64 {
return a - b
}
func funcMul (a, b float64) float64 {
return a * b
}
func funcDiv (a, b float64) float64 {
return a / b
}