Skip to content

Commit

Permalink
Make core/unid accept maps as well
Browse files Browse the repository at this point in the history
  • Loading branch information
verberktstan committed May 29, 2024
1 parent b924671 commit b1ab5ce
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/swark/core.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,11 @@
([existing]
(unid nil existing))
([{:keys [min-length filter-regex no-dashes?] :or {min-length 1}} existing]
(-> existing set? assert)
;; (-> existing set? assert)
(assert (or (map? existing) (set? existing)))
(reduce
(fn [s char]
(if (and s (>= (count s) min-length) (-> s existing not) (-> s reverse first #{"-"} not))
(if (and s (>= (count s) min-length) (->> s (contains? existing) not) (-> s reverse first #{"-"} not))
(reduced s)
(str s char)))
nil
Expand Down

0 comments on commit b1ab5ce

Please sign in to comment.