There was an error while loading. Please reload this page.
2 parents a4f94bc + b9cf3c8 commit b132dd7Copy full SHA for b132dd7
1 file changed
src/main/cljs/cljs/core.cljs
@@ -5254,6 +5254,16 @@ reduces them without incurring seq initialization"
5254
([f] (lazy-seq (cons (f) (repeatedly f))))
5255
([n f] (take n (repeatedly f))))
5256
5257
+(defn some-vals
5258
+ "Returns a map with only the non-nil values of map m. Returns nil if
5259
+ m has no non-nil vals."
5260
+ {:added "1.13"
5261
+ :static true}
5262
+ [m]
5263
+ (reduce-kv
5264
+ (fn [m k v] (if (some? v) (assoc m k v) m))
5265
+ nil m))
5266
+
5267
(def ^:private UNREALIZED-SEED #js {})
5268
5269
(deftype Iterate [meta f prev-seed ^:mutable seed ^:mutable next]
0 commit comments