kendru / learn-cljs

Source code for Learn ClojureScript
64 stars 27 forks source link

`make-contact` function needs fix #81

Closed MityaDementiy closed 1 year ago

MityaDementiy commented 1 year ago

Hi, @kendru! I worked with Contact Book capstone project and noticed the problem. When I use this code:

(defn maybe-set-address [contact]                          ;; <1>
  (if (:address contact)
    (update contact :address make-address)
    contact))

(defn make-contact [contact]
  (-> contact                                              ;; <2>
      (select-keys [:first-name :last-name :email])
      (maybe-set-address)))

make-contact function returns contact without :address field. I assume it should be fixed in this way:

(defn make-contact [contact]
  (-> contact
      (select-keys [:first-name :last-name :email :address])
      (maybe-set-address)))

Thank you for this great book!

kendru commented 1 year ago

Thank you so much for the fixes!