From b3010e23b1b87abae0e8ff4a46c9bbb15bee0ad4 Mon Sep 17 00:00:00 2001 From: gered Date: Sat, 14 Jun 2014 22:17:41 -0400 Subject: [PATCH] fix support for strings in index_of and last_index_of --- src/clj_jtwig/standard_functions.clj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/clj_jtwig/standard_functions.clj b/src/clj_jtwig/standard_functions.clj index 1e1a70e..d012c67 100644 --- a/src/clj_jtwig/standard_functions.clj +++ b/src/clj_jtwig/standard_functions.clj @@ -50,14 +50,14 @@ {:fn (fn [coll value] (cond (instance? java.util.List coll) (.indexOf coll value) - (string? coll) (.indexOf coll value) + (string? coll) (.indexOf coll (if (char? value) (int value) value)) :else (throw (new Exception (str "'index_if' passed invalid collection type: " (type coll))))))} "last_index_of" {:fn (fn [coll value] (cond (instance? java.util.List coll) (.lastIndexOf coll value) - (string? coll) (.lastIndexOf coll value) + (string? coll) (.lastIndexOf coll (if (char? value) (int value) value)) :else (throw (new Exception (str "'last_index_if' passed invalid collection type: " (type coll))))))} "max"