]> jfr.im git - irc/quakenet/qwebirc.git/blobdiff - js/jslib.js
Merge pull request #324 from retropc/master
[irc/quakenet/qwebirc.git] / js / jslib.js
index 719f3b2bfe1cedfecd6996ea2e2940ce088f6b66..1094ff2ec440438f8797582869af20c68dc7c507 100644 (file)
@@ -223,6 +223,10 @@ String.prototype.startsWith = function(what) {
   return this.substring(0, what.length) == what;
 }
 
+String.prototype.endsWith = function(what) {
+  return this.substring(this.length - what.length, this.length) == what;
+};
+
 /* NOT cryptographically secure! */
 qwebirc.util.randHexString = function(numBytes) {
   var getByte = function() {
@@ -416,7 +420,22 @@ qwebirc.util.deviceHasKeyboard = function() {
 qwebirc.util.generateID_ID = 0;
 qwebirc.util.generateID = function() {
   return "qqa-" + qwebirc.util.generateID_ID++;
-}
+};
+
+qwebirc.util.arrayCmp = function(a, b) {
+  for(var p=0;p<a.length;p++) {
+    var ap = a[p];
+    var bp = b[p];
+    if(ap == bp)
+      continue;
+
+    if(ap < bp)
+      return -1;
+
+    return 1;
+  }
+  return 0;
+};
 
 qwebirc.util.__log = function(x) {
   if(QWEBIRC_DEBUG) {