fix support for strings in index_of and last_index_of
This commit is contained in:
parent
326b1eef7a
commit
b3010e23b1
|
@ -50,14 +50,14 @@
|
||||||
{:fn (fn [coll value]
|
{:fn (fn [coll value]
|
||||||
(cond
|
(cond
|
||||||
(instance? java.util.List coll) (.indexOf coll value)
|
(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))))))}
|
:else (throw (new Exception (str "'index_if' passed invalid collection type: " (type coll))))))}
|
||||||
|
|
||||||
"last_index_of"
|
"last_index_of"
|
||||||
{:fn (fn [coll value]
|
{:fn (fn [coll value]
|
||||||
(cond
|
(cond
|
||||||
(instance? java.util.List coll) (.lastIndexOf coll value)
|
(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))))))}
|
:else (throw (new Exception (str "'last_index_if' passed invalid collection type: " (type coll))))))}
|
||||||
|
|
||||||
"max"
|
"max"
|
||||||
|
|
Reference in a new issue