add alias for "blankIfNull"

This commit is contained in:
Gered 2014-03-04 14:37:48 -05:00
parent 1595d54041
commit fdcd0d74d3
2 changed files with 5 additions and 2 deletions

View file

@ -13,7 +13,8 @@
(defonce standard-functions
{"blankIfNull"
{:fn (fn [x]
(if (nil? x) "" x))}
(if (nil? x) "" x))
:aliases ["nonull"]}
"butlast"
{:fn (fn [sequence]

View file

@ -250,7 +250,9 @@
(is (= (render "{{ a|blankIfNull }}" {:a nil})
""))
(is (= (render "{{ a|blankIfNull }}" {:a "foo"})
"foo")))
"foo"))
(is (= (render "{{ a|nonull }}" nil)
"")))
(testing "butlast"
(is (= (render "{{ [1, 2, 3, 4, 5]|butlast }}" nil)