Commit graph

15 commits

Author SHA1 Message Date
Oleksandr Redko bda082c98c
tpl: Add math.Abs
Fixes #10941.
2023-05-16 18:32:07 +02:00
septs f5eddf89bf
tpl/math: Return error if less than 2 input numbers
Fixes #10827
2023-03-14 09:28:38 +01:00
septs 84201e8d5d
tpl/math: Allow multi numbers in add, sub, mul, div, min and max 2023-03-11 11:21:08 +01:00
Bjørn Erik Pedersen b80853de90
all: gofmt -w -r 'interface{} -> any' .
Updates #9687
2022-03-17 22:03:27 +01:00
Joe Mooring 01758f99b9 Add math.Max and math.Min
Closes #8583
2021-05-28 20:38:45 +02:00
Bjørn Erik Pedersen d90e37e0c6 all: Format code with gofumpt
See https://github.com/mvdan/gofumpt
2020-12-03 13:12:58 +01:00
Joe Mooring 991934497e Add math.Pow
Closes #7266
2020-05-14 10:00:31 +02:00
Chris Dennis d184e5059c
tpl: Add math.Sqrt
Fixes #6941
2020-02-24 23:45:04 +01:00
Bjørn Erik Pedersen 9e57182705
tests: Convert from testify to quicktest 2019-08-12 13:26:32 +02:00
Bjørn Erik Pedersen 2b8d907ab7 Add a newScratch template func
Fixes #4685
2018-07-06 17:51:38 +02:00
Artem Sidorenko 76dc811c65 tpl/math: Refactor Mod with cast
It makes the code smaller
2017-10-30 21:55:36 +01:00
Cameron Moore 19c5910485 tpl: Add math.Ceil, Floor, and Round
Ceil and Floor are frontends for the stdlib math functions. The Round
implementation is essentially the same thing except that the Go stdlib
doesn't include a Round implementation in a stable release yet.  I've
included the Round function slated for Go 1.10.

Fixes #3883
2017-09-24 10:06:14 +02:00
Artem Sidorenko 34c566773a tpl/math: Add log function
It might be very useful for building tag clouds.
2017-07-03 00:20:48 +02:00
Bjørn Erik Pedersen 0e2260421e tpl: Fix the remaining template funcs namespace issues
See #3042
2017-05-01 15:13:41 +02:00
Cameron Moore de7c32a1a8 tpl: Add template function namespaces
This commit moves almost all of the template functions into separate
packages under tpl/ and adds a namespace framework.  All changes should
be backward compatible for end users, as all existing function names in
the template funcMap are left intact.

Seq and DoArithmatic have been moved out of the helpers package and into
template namespaces.

Most of the tests involved have been refactored, and many new tests have
been written.  There's still work to do, but this is a big improvement.

I got a little overzealous and added some new functions along the way:

- strings.Contains
- strings.ContainsAny
- strings.HasSuffix
- strings.TrimPrefix
- strings.TrimSuffix

Documentation is forthcoming.

Fixes #3042
2017-04-30 10:56:38 +02:00