Skip to content

Commit

Permalink
deterministic sort
Browse files Browse the repository at this point in the history
  • Loading branch information
frenchy64 committed Jul 8, 2024
1 parent 30b5868 commit e89ff76
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/flanders/core.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,13 @@
(defn enum [values & {:keys [open?]
:or {open? false}
:as opts}]
(let [v (first values)
default (-> values sort first)]
(let [values (into (sorted-set) values)
v (first values)]
(cond
(integer? v) (ft/map->IntegerType (merge {:default default} opts {:values values :open? open?}))
(number? v) (ft/map->NumberType (merge {:default default} opts {:values values :open? open?}))
(keyword? v) (ft/map->KeywordType (merge {:default default} opts {:values values :open? open?}))
(string? v) (ft/map->StringType (merge {:default default} opts {:values values :open? open?})))))
(integer? v) (ft/map->IntegerType (merge {:default v} opts {:values values :open? open?}))
(number? v) (ft/map->NumberType (merge {:default v} opts {:values values :open? open?}))
(keyword? v) (ft/map->KeywordType (merge {:default v} opts {:values values :open? open?}))
(string? v) (ft/map->StringType (merge {:default v} opts {:values values :open? open?})))))

(defn eq [value & {:keys [description reference comment usage name]}]
(enum #{value}
Expand Down

0 comments on commit e89ff76

Please sign in to comment.