summaryrefslogtreecommitdiffstats
path: root/tpl/math/init.go
diff options
context:
space:
mode:
authorOleksandr Redko <Oleksandr_Redko@epam.com>2023-05-16 19:32:07 +0300
committerGitHub <noreply@github.com>2023-05-16 18:32:07 +0200
commitbda082c98c7a0abdb019f12bb21cbaa7b0e8f60e (patch)
tree264dad483cd16238fa1864c7c3f127d4f72d24f4 /tpl/math/init.go
parent241b21b0fd34d91fccb2ce69874110dceae6f926 (diff)
tpl: Add math.Abs
Fixes #10941.
Diffstat (limited to 'tpl/math/init.go')
-rw-r--r--tpl/math/init.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/tpl/math/init.go b/tpl/math/init.go
index 67aa95f41..8596ff647 100644
--- a/tpl/math/init.go
+++ b/tpl/math/init.go
@@ -31,6 +31,13 @@ func init() {
Context: func(cctx context.Context, args ...any) (any, error) { return ctx, nil },
}
+ ns.AddMethodMapping(ctx.Abs,
+ nil,
+ [][2]string{
+ {"{{ math.Abs -2.1 }}", "2.1"},
+ },
+ )
+
ns.AddMethodMapping(ctx.Add,
[]string{"add"},
[][2]string{