Add obj/array? helper

This commit is contained in:
Andrey Antukh 2023-09-12 14:00:18 +02:00
parent b1e54a9714
commit e6f8022de0
2 changed files with 6 additions and 2 deletions

View file

@ -42,7 +42,7 @@
(defn propagate-wrapper-styles (defn propagate-wrapper-styles
([children wrapper-props] ([children wrapper-props]
(if (.isArray js/Array children) (if ^boolean (obj/array? children)
(->> children (map #(propagate-wrapper-styles-child % wrapper-props))) (->> children (map #(propagate-wrapper-styles-child % wrapper-props)))
(-> children (propagate-wrapper-styles-child wrapper-props))))) (-> children (propagate-wrapper-styles-child wrapper-props)))))

View file

@ -6,11 +6,15 @@
(ns app.util.object (ns app.util.object
"A collection of helpers for work with javascript objects." "A collection of helpers for work with javascript objects."
(:refer-clojure :exclude [set! new get get-in merge clone contains?]) (:refer-clojure :exclude [set! new get get-in merge clone contains? array?])
(:require (:require
["lodash/omit" :as omit] ["lodash/omit" :as omit]
[cuerdas.core :as str])) [cuerdas.core :as str]))
(defn array?
[o]
(.isArray js/Array o))
(defn create [] #js {}) (defn create [] #js {})
(defn get (defn get