fix support for strings in index_of and last_index_of

This commit is contained in:
Gered 2014-06-14 22:17:41 -04:00
parent 326b1eef7a
commit b3010e23b1

View file

@ -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"