From e6f8022de0cf03fe076145ab960aaea658e931b9 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 12 Sep 2023 14:00:18 +0200 Subject: [PATCH] :sparkles: Add obj/array? helper --- frontend/src/app/main/ui/shapes/shape.cljs | 2 +- frontend/src/app/util/object.cljs | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/main/ui/shapes/shape.cljs b/frontend/src/app/main/ui/shapes/shape.cljs index 659ce9f238..0cb212a8ab 100644 --- a/frontend/src/app/main/ui/shapes/shape.cljs +++ b/frontend/src/app/main/ui/shapes/shape.cljs @@ -42,7 +42,7 @@ (defn propagate-wrapper-styles ([children wrapper-props] - (if (.isArray js/Array children) + (if ^boolean (obj/array? children) (->> children (map #(propagate-wrapper-styles-child % wrapper-props))) (-> children (propagate-wrapper-styles-child wrapper-props))))) diff --git a/frontend/src/app/util/object.cljs b/frontend/src/app/util/object.cljs index 4c6d319814..c9caf8f2b9 100644 --- a/frontend/src/app/util/object.cljs +++ b/frontend/src/app/util/object.cljs @@ -6,11 +6,15 @@ (ns app.util.object "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 ["lodash/omit" :as omit] [cuerdas.core :as str])) +(defn array? + [o] + (.isArray js/Array o)) + (defn create [] #js {}) (defn get