0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-13 10:38:13 -05:00

🎉 Add d/unstable-sort helper

This commit is contained in:
Andrey Antukh 2023-08-25 11:02:26 +02:00 committed by Andrés Moya
parent 59600d07c3
commit ce0842ce87

View file

@ -18,6 +18,7 @@
:clj [clojure.edn :as r])
#?(:cljs [cljs.core :as c]
:clj [clojure.core :as c])
#?(:cljs [goog.array :as garray])
[app.common.math :as mth]
[clojure.set :as set]
[cuerdas.core :as str]
@ -780,6 +781,18 @@
(toString 16)
(padStart 2 "0"))))
(defn unstable-sort
([items]
(unstable-sort compare items))
([comp-fn items]
#?(:cljs
(let [items (to-array items)]
(garray/sort items comp-fn)
(seq items))
:clj
(sort comp-fn items))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; String Functions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;