Skip to content

Commit 8a69d23

Browse files
moorereasonbep
authored andcommitted
tpl: Add math.Ceil, Floor, and Round to method mappings
1 parent d9697e2 commit 8a69d23

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

‎tpl/math/init.go‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,27 @@ func init() {
3636
},
3737
)
3838

39+
ns.AddMethodMapping(ctx.Ceil,
40+
nil,
41+
[][2]string{
42+
{"{{math.Ceil 2.1}}", "3"},
43+
},
44+
)
45+
3946
ns.AddMethodMapping(ctx.Div,
4047
[]string{"div"},
4148
[][2]string{
4249
{"{{div 6 3}}", "2"},
4350
},
4451
)
4552

53+
ns.AddMethodMapping(ctx.Floor,
54+
nil,
55+
[][2]string{
56+
{"{{math.Floor 1.9}}", "1"},
57+
},
58+
)
59+
4660
ns.AddMethodMapping(ctx.Log,
4761
nil,
4862
[][2]string{
@@ -71,6 +85,13 @@ func init() {
7185
},
7286
)
7387

88+
ns.AddMethodMapping(ctx.Round,
89+
nil,
90+
[][2]string{
91+
{"{{math.Round 1.5}}", "2"},
92+
},
93+
)
94+
7495
ns.AddMethodMapping(ctx.Sub,
7596
[]string{"sub"},
7697
[][2]string{

0 commit comments

Comments
 (0)