function | since v1.9.456 | clojure.lang/PersistentHashSet.createWithCheck | Edit |
(PersistentHashSet.createWithCheck items)
(set! (.-createWithCheck PersistentHashSet)
(fn [items]
(let [len (alength items)
t (-as-transient (.-EMPTY PersistentHashSet))]
(dotimes [i len]
(-conj! t (aget items i))
(when-not (= (count t) (inc i))
(throw (js/Error. (str "Duplicate key: " (aget items i))))))
(-persistent! t))))