We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There are a number of filter functions which might be common or useful enough to provide by default. Some options:
Type conversion filters could be useful, e.g.
bool
false
int
list
These would be useful for if statements
eq
ne
gt
gte
lt
lte
and
or
not
abs
add <v>
sub <v>
mul <v>
div <v>
round
len
length
size
lower
upper
title
trim
strip
ltrim
lstrip
rtrim
rstrip
reverse
replace <from> <to>
append <s>
prepend <s>
first
last
slice
nth <n>
join <sep>
concat <sep>
uniq
sorted
Value
keys
values
The text was updated successfully, but these errors were encountered:
I think json and date are also commonly used.
json
date
{{ my_object_instance | json }} => {"field1" : "text1"} {{ create_time | date: "yyyy-MM-dd HH:mm:ss.SSS" }} => 2024-08-23 10:00:00.000
{{ my_object_instance | json }}
{"field1" : "text1"}
{{ create_time | date: "yyyy-MM-dd HH:mm:ss.SSS" }}
2024-08-23 10:00:00.000
Sorry, something went wrong.
No branches or pull requests
There are a number of filter functions which might be common or useful enough to provide by default. Some options:
Examples
General
Type conversion filters could be useful, e.g.
bool
: convert a value to a boolean using "truthy" logic, e.g. empty string, list, and map isfalse
, zero integer and float is false.int
: convert from boolean and float to intlist
: convert map to a list of lists of length two.Booleans
These would be useful for if statements
eq
,ne
gt
,gte
,lt
,lte
and
,or
not
Numbers
abs
: returns the absolute value of the numberadd <v>
,sub <v>
mul <v>
,div <v>
round
: rounds to the given precisionStrings
len
/length
/size
: return the length of the stringlower
: convert a string to lowercaseupper
: convert a string to uppercasetitle
: convert a string to titlecasetrim
/strip
: trims whitespace from a stringltrim
/lstrip
,rtrim
/rstrip
: trims whitespace from a string from the one endreverse
: reverses the listreplace <from> <to>
: replaces a substring with anotherappend <s>
: appends the given stringprepend <s>
: prepends the given stringLists
len
/length
/size
: return the length of the listfirst
: return the first item in a listlast
: return the last item in a listslice
: slice a listnth <n>
: return the nth item in a listjoin <sep>
/concat <sep>
: join a sequence by separatoruniq
: remove any duplicate items from the listsorted
: sorts the list (? how should differently typedValue
s be ordered?)Maps
len
/length
/size
: return the length of the mapkeys
: returns a list of the keys in the mapvalues
: returns a list of the values in the mapfirst
: return the first item in the maplast
: return the last item in the mapThe text was updated successfully, but these errors were encountered: