aboutsummaryrefslogtreecommitdiffstats
path: root/data/util.js
diff options
context:
space:
mode:
Diffstat (limited to 'data/util.js')
-rw-r--r--data/util.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/data/util.js b/data/util.js
index 7753458..5e8afcc 100644
--- a/data/util.js
+++ b/data/util.js
@@ -192,3 +192,20 @@ function killNodes(doc, target, remove) {
}
});
}
+
+/**
+ * Remove duplicate elements from array
+ *
+ * @param arr Array which needs to be cleaned up
+ * @return cleaned up array
+ */
+function removeDuplicates (arr) {
+ for (var i = 0; i < arr.length; i++) {
+ for (var j = i + 1; j < arr.length; j++) {
+ if (arr[i] == arr[j]) {
+ arr.splice (j, 1);
+ }
+ }
+ }
+ return arr;
+}