Skip to content

Commit

Permalink
don't replace false keys
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexCuse committed Oct 17, 2014
1 parent 9cac7f0 commit 029f005
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/_filter/collection/group-by.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ angular.module('a8m.group-by', [ 'a8m.filter-watcher' ])
getParse = $parse(property),
get = function(el) {
var val = getParse(el);
if(nullReplacement !== undefined && !val){
if(nullReplacement !== undefined && (val == null || val == undefined)){
return nullReplacement;
}
return val;
Expand Down
6 changes: 4 additions & 2 deletions test/spec/filter/collection/group-by.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,16 @@ describe('groupByFilter', function() {
{name: 'Paula', team: 'beta'},
{name: 'Scruath', team: 'gamma'},
{name: 'Alex', team: null },
{name: 'Rob' }
{name: 'Rob' },
{name: 'Sven', team: false }
];

expect(filter(players, 'team', 'a')).toEqual( {
a: [players[5], players[6]],
alpha: [players[0]],
beta: [players[1], players[3]],
gamma: [players[2], players[4]]
gamma: [players[2], players[4]],
'false': [players[7]]
});

});
Expand Down

0 comments on commit 029f005

Please sign in to comment.