diff --git a/src/clj_jtwig/standard_functions.clj b/src/clj_jtwig/standard_functions.clj index 1d591d9..a4a034f 100644 --- a/src/clj_jtwig/standard_functions.clj +++ b/src/clj_jtwig/standard_functions.clj @@ -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] diff --git a/test/clj_jtwig/functions_test.clj b/test/clj_jtwig/functions_test.clj index 1aa1db8..09be3ba 100644 --- a/test/clj_jtwig/functions_test.clj +++ b/test/clj_jtwig/functions_test.clj @@ -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)