diff options
Diffstat (limited to 'lib/util.js')
-rw-r--r-- | lib/util.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/util.js b/lib/util.js index 0b1a79e..88c3457 100644 --- a/lib/util.js +++ b/lib/util.js @@ -216,3 +216,14 @@ exports.getObjectKeys = function getObjectKeys(obj) { } return keys; }; + +exports.removeDuplicates = 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; +}; |