about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/util
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-05-27 19:33:28 +0200
committerThibG <thib@sitedethib.com>2018-05-29 21:25:28 +0200
commit4b38ac3bed78dfbd5159af37674c18a7ea5e69d5 (patch)
tree134bd6abc76cd009e0b2e4a6c7de39333e480765 /app/javascript/flavours/glitch/util
parent6020a211304a3c33cc311083b15edc3f08a13edc (diff)
[Glitch] Fix comparing id
Port 0ba49eca8b49c6ce0ec04fd546951c95938da4e6 to glitch-soc
Diffstat (limited to 'app/javascript/flavours/glitch/util')
-rw-r--r--app/javascript/flavours/glitch/util/compare_id.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/util/compare_id.js b/app/javascript/flavours/glitch/util/compare_id.js
new file mode 100644
index 000000000..aaff66481
--- /dev/null
+++ b/app/javascript/flavours/glitch/util/compare_id.js
@@ -0,0 +1,10 @@
+export default function compareId(id1, id2) {
+  if (id1 === id2) {
+    return 0;
+  }
+  if (id1.length === id2.length) {
+    return id1 > id2 ? 1 : -1;
+  } else {
+    return id1.length > id2.length ? 1 : -1;
+  }
+}