mirror of
https://github.com/penpot/penpot.git
synced 2025-06-05 09:31:39 +02:00
🎉 Add d/unstable-sort
helper
This commit is contained in:
parent
59600d07c3
commit
ce0842ce87
1 changed files with 13 additions and 0 deletions
|
@ -18,6 +18,7 @@
|
||||||
:clj [clojure.edn :as r])
|
:clj [clojure.edn :as r])
|
||||||
#?(:cljs [cljs.core :as c]
|
#?(:cljs [cljs.core :as c]
|
||||||
:clj [clojure.core :as c])
|
:clj [clojure.core :as c])
|
||||||
|
#?(:cljs [goog.array :as garray])
|
||||||
[app.common.math :as mth]
|
[app.common.math :as mth]
|
||||||
[clojure.set :as set]
|
[clojure.set :as set]
|
||||||
[cuerdas.core :as str]
|
[cuerdas.core :as str]
|
||||||
|
@ -780,6 +781,18 @@
|
||||||
(toString 16)
|
(toString 16)
|
||||||
(padStart 2 "0"))))
|
(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
|
;; String Functions
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue