This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns viebel.gist-57d9ebad3381e727c2f0a373e1bd4eec.raw.spec-example | |
(:require [cljs.spec :as s])) | |
(s/def ::tag (s/cat :type #{:div} | |
:attrs map? | |
:children (s/spec (s/* ::tag)))) | |
(s/explain ::tag [:div {} [[:div {} []]]]) | |
;; In: [2 0] val: [:div {} []] fails spec: _ at: [:children :type] predicate: #{:div} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Make a regex behave like a function | |
; Inspired by: http://blog.klipse.tech/clojure/2016/04/07/ifn.html | |
(extend-type js/RegExp | |
IFn | |
(-invoke ([this s] (re-find this s)))) | |
(#"clojure" "clojurescript") | |
NewerOlder