Improve word-string schema generator

make it to generate a more readable strings
This commit is contained in:
Andrey Antukh
2024-08-16 12:04:18 +02:00
parent db52d98595
commit 0db1eed87f

View File

@@ -77,14 +77,11 @@
(defn word-string
[]
(as-> tg/string-alphanumeric $$
(tg/such-that (fn [v] (re-matches #"\w+" v)) $$ 50)
(tg/such-that (fn [v]
(and (not (str/blank? v))
(not (re-matches #"^\d+.*" v))))
$$
50)))
(as-> tg/string-ascii $$
(tg/resize 10 $$)
(tg/fmap (fn [v] (apply str (re-seq #"[A-Za-z]+" v))) $$)
(tg/such-that (fn [v] (>= (count v) 4)) $$ 100)
(tg/fmap str/lower $$)))
(defn email
[]