update 'contains' to allow checking for a substring in a string
This commit is contained in:
parent
4ca3efc9f7
commit
ceed7a25a0
|
@ -38,10 +38,12 @@
|
||||||
|
|
||||||
"contains"
|
"contains"
|
||||||
{:fn (fn [coll value]
|
{:fn (fn [coll value]
|
||||||
(if (map? coll)
|
(cond
|
||||||
(contains? coll (possible-keyword-string value))
|
(map? coll) (contains? coll (possible-keyword-string value))
|
||||||
|
(string? coll) (.contains coll value)
|
||||||
; explicit use of '=' to allow testing for falsey values
|
; explicit use of '=' to allow testing for falsey values
|
||||||
(some #(= value %) coll)))}
|
(coll? coll) (not (nil? (some #(= value %) coll)))
|
||||||
|
:else (throw (new Exception (str "'contains' passed invalid collection type: " (type coll))))))}
|
||||||
|
|
||||||
"dump"
|
"dump"
|
||||||
{:fn (fn [x]
|
{:fn (fn [x]
|
||||||
|
|
Reference in a new issue