0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-12 15:51:37 -05:00

🐛 Fix wrong type hints

This commit is contained in:
Andrey Antukh 2022-03-29 18:23:39 +02:00 committed by Andrés Moya
parent 6f7f74f7c6
commit f303d3c45d
4 changed files with 14 additions and 14 deletions

View file

@ -26,7 +26,7 @@
(toString [_] (toString [_]
(str "matrix(" a "," b "," c "," d "," e "," f ")"))) (str "matrix(" a "," b "," c "," d "," e "," f ")")))
(defn ^boolean matrix? (defn matrix?
"Return true if `v` is Matrix instance." "Return true if `v` is Matrix instance."
[v] [v]
(instance? Matrix v)) (instance? Matrix v))

View file

@ -21,7 +21,7 @@
(defn s [{:keys [x y]}] (str "(" x "," y ")")) (defn s [{:keys [x y]}] (str "(" x "," y ")"))
(defn ^boolean point? (defn point?
"Return true if `v` is Point instance." "Return true if `v` is Point instance."
[v] [v]
(or (instance? Point v) (or (instance? Point v)
@ -33,7 +33,7 @@
(s/def ::point (s/def ::point
(s/and (s/keys :req-un [::x ::y]) point?)) (s/and (s/keys :req-un [::x ::y]) point?))
(defn ^boolean point-like? (defn point-like?
[{:keys [x y] :as v}] [{:keys [x y] :as v}]
(and (map? v) (and (map? v)
(not (nil? x)) (not (nil? x))

View file

@ -17,28 +17,28 @@
;; GENERIC SHAPE SELECTORS AND PREDICATES ;; GENERIC SHAPE SELECTORS AND PREDICATES
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn ^boolean root-frame? (defn root-frame?
[{:keys [id type]}] [{:keys [id type]}]
(and (= type :frame) (and (= type :frame)
(= id uuid/zero))) (= id uuid/zero)))
(defn ^boolean frame-shape? (defn frame-shape?
[{:keys [type]}] [{:keys [type]}]
(= type :frame)) (= type :frame))
(defn ^boolean group-shape? (defn group-shape?
[{:keys [type]}] [{:keys [type]}]
(= type :group)) (= type :group))
(defn ^boolean text-shape? (defn text-shape?
[{:keys [type]}] [{:keys [type]}]
(= type :text)) (= type :text))
(defn ^boolean image-shape? (defn image-shape?
[{:keys [type]}] [{:keys [type]}]
(= type :image)) (= type :image))
(defn ^boolean unframed-shape? (defn unframed-shape?
"Checks if it's a non-frame shape in the top level." "Checks if it's a non-frame shape in the top level."
[shape] [shape]
(and (not (frame-shape? shape)) (and (not (frame-shape? shape))
@ -218,7 +218,7 @@
([libraries library-id component-id] ([libraries library-id component-id]
(get-in libraries [library-id :data :components component-id]))) (get-in libraries [library-id :data :components component-id])))
(defn ^boolean is-main-of? (defn is-main-of?
[shape-main shape-inst] [shape-main shape-inst]
(and (:shape-ref shape-inst) (and (:shape-ref shape-inst)
(or (= (:shape-ref shape-inst) (:id shape-main)) (or (= (:shape-ref shape-inst) (:id shape-main))

View file

@ -63,16 +63,16 @@
(filter match?) (filter match?)
(seq)))) (seq))))
(defn ^boolean is-text-node? (defn is-text-node?
[node] [node]
(and (string? (:text node)) (and (string? (:text node))
(not= (:text node) ""))) (not= (:text node) "")))
(defn ^boolean is-paragraph-node? (defn is-paragraph-node?
[node] [node]
(= "paragraph" (:type node))) (= "paragraph" (:type node)))
(defn ^boolean is-root-node? (defn is-root-node?
[node] [node]
(= "root" (:type node))) (= "root" (:type node)))