diff options
Diffstat (limited to 'js/vendor/angular-ui/modules/filters/unique/unique.js')
-rw-r--r-- | js/vendor/angular-ui/modules/filters/unique/unique.js | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/js/vendor/angular-ui/modules/filters/unique/unique.js b/js/vendor/angular-ui/modules/filters/unique/unique.js deleted file mode 100644 index 382712297..000000000 --- a/js/vendor/angular-ui/modules/filters/unique/unique.js +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Filters out all duplicate items from an array by checking the specified key - * @param [key] {string} the name of the attribute of each object to compare for uniqueness - if the key is empty, the entire object will be compared - if the key === false then no filtering will be performed - * @return {array} - */ -angular.module('ui.filters').filter('unique', function () { - - return function (items, filterOn) { - - if (filterOn === false) { - return items; - } - - if ((filterOn || angular.isUndefined(filterOn)) && angular.isArray(items)) { - var hashCheck = {}, newItems = []; - - var extractValueToCompare = function (item) { - if (angular.isObject(item) && angular.isString(filterOn)) { - return item[filterOn]; - } else { - return item; - } - }; - - angular.forEach(items, function (item) { - var valueToCheck, isDuplicate = false; - - for (var i = 0; i < newItems.length; i++) { - if (angular.equals(extractValueToCompare(newItems[i]), extractValueToCompare(item))) { - isDuplicate = true; - break; - } - } - if (!isDuplicate) { - newItems.push(item); - } - - }); - items = newItems; - } - return items; - }; -}); |