Commit 503e7542 by Jeffrey Phillips

Simplify filters

parent 090cf7ac
......@@ -1059,26 +1059,16 @@ angular.module('openshiftCommonUI')
angular.module('openshiftCommonUI')
.filter("toArray", function() {
return function (items) {
if (!items) {
return [];
}
if (angular.isArray(items)) {
return items;
}
var itemsArray = [];
angular.forEach(items, function (item) {
itemsArray.push(item);
});
return itemsArray;
};
return _.toArray;
})
.filter('size', function() {
return _.size;
})
.filter('hashSize', function() {
.filter('hashSize', function($log) {
return function(hash) {
if(!hash) { return 0; }
if (!hash) {
return 0;
}
return Object.keys(hash).length;
};
})
......
......@@ -1266,29 +1266,19 @@ angular.module('openshiftCommonUI')
angular.module('openshiftCommonUI')
.filter("toArray", function() {
return function (items) {
if (!items) {
return [];
}
if (angular.isArray(items)) {
return items;
}
var itemsArray = [];
angular.forEach(items, function (item) {
itemsArray.push(item);
});
return itemsArray;
};
return _.toArray;
})
.filter('size', function() {
return _.size;
})
.filter('hashSize', function() {
.filter('hashSize', ["$log", function($log) {
return function(hash) {
if(!hash) { return 0; }
if (!hash) {
return 0;
}
return Object.keys(hash).length;
};
})
}])
.filter('generateName', function() {
return function(prefix, length) {
if (!prefix) {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -2,26 +2,16 @@
angular.module('openshiftCommonUI')
.filter("toArray", function() {
return function (items) {
if (!items) {
return [];
}
if (angular.isArray(items)) {
return items;
}
var itemsArray = [];
angular.forEach(items, function (item) {
itemsArray.push(item);
});
return itemsArray;
};
return _.toArray;
})
.filter('hashSize', function() {
.filter('size', function() {
return _.size;
})
.filter('hashSize', function($log) {
return function(hash) {
if(!hash) { return 0; }
if (!hash) {
return 0;
}
return Object.keys(hash).length;
};
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment