We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents eb0ac6e + 3d9856c commit ac3494aCopy full SHA for ac3494a
labelSelector.js
@@ -85,14 +85,13 @@ LabelSelector.prototype.each = function(fn) {
85
};
86
87
LabelSelector.prototype.select = function(resources) {
88
- var selectedResources = {};
89
- var self = this;
90
- angular.forEach(resources, function(resource, resId) {
91
- if (self.matches(resource)) {
92
- selectedResources[resId] = resource;
93
- }
94
- });
95
- return selectedResources;
+ // If passed an array, return an array.
+ if (_.isArray(resources)) {
+ return _.filter(resources, this.matches, this);
+ }
+
+ // Otherwise handle it as a map.
+ return _.pick(resources, this.matches, this);
96
97
98
LabelSelector.prototype.matches = function(resource) {
0 commit comments