Skip to content

Commit

Permalink
fix hash-map trasnformer
Browse files Browse the repository at this point in the history
  • Loading branch information
mthbernardes committed Dec 24, 2022
1 parent 183e451 commit 964f380
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/shape_shifter/transform.clj
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,13 @@
(filter (comp #(not= :whitespace %) first))
(map transform)
(partition 2)
(map utils/build-hashmap-function)
first)]
`(-> ~result s/and s/spec)))
(map utils/build-hashmap-function))
and-spec (utils/apply-on-macro `s/and result)]
`(s/spec ~and-spec)))


(defn ->spec [pattern]
(let [parsed-code (-> pattern
(parcera/ast :unhide :literals)
(nth 1))]
(-> parsed-code transform str sci/eval-string)))


(s/valid? (->spec "{:banana 10}") {:banana 10})

0 comments on commit 964f380

Please sign in to comment.