Add percentChange function

This commit is contained in:
Svilen Markov
2025-05-11 21:09:12 +01:00
parent 7bbf103e01
commit baaf306ebf
3 changed files with 9 additions and 0 deletions

View File

@@ -445,6 +445,7 @@ The following helper functions provided by Glance are available:
- `sortByTime(key string, layout string, order string, arr []JSON): []JSON`: Sorts an array of JSON objects by a time key in either ascending or descending order. The format must be provided in Go's [date format](https://pkg.go.dev/time#pkg-constants).
- `concat(strings ...string) string`: Concatenates multiple strings together.
- `unique(key string, arr []JSON) []JSON`: Returns a unique array of JSON objects based on the given key.
- `percentChange(current float, previous float) float`: Calculates the percentage change between two numbers.
The following helper functions provided by Go's `text/template` are available: