Navigation Menu

Skip to content

Commit

Permalink
update Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Sep 25, 2015
1 parent eaec9b5 commit 7e9cd70
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions Changes
@@ -1,6 +1,7 @@

6.22 2015-09-25
- Improved Mojo::JSON by reusing JSON::PP boolean constants.
- Improved uniq method in Mojo::Collection to accept a callback. (CandyAngel)
- Improved support for empty attributes in Mojo::DOM::HTML.

6.21 2015-09-23
Expand Down
5 changes: 2 additions & 3 deletions lib/Mojo/Collection.pm
Expand Up @@ -95,8 +95,7 @@ sub to_array { [@{shift()}] }
sub uniq {
my ($self, $cb) = @_;
my %seen;
return $self->new(grep { !$seen{ $cb->($_) }++ } @$self)
if ref $cb eq 'CODE';
return $self->new(grep { !$seen{$cb->($_)}++ } @$self) if $cb;
return $self->new(grep { !$seen{$_}++ } @$self);
}

Expand Down Expand Up @@ -344,7 +343,7 @@ representation of either the elements or the return value of the callback.
# "foo bar baz"
Mojo::Collection->new('foo', 'bar', 'bar', 'baz')->uniq->join(' ');
# [[1, 2, 3]]
# "[[1, 2, 3]]"
Mojo::Collection->new([1, 2, 3], [3, 2, 1])->uniq(sub{ $_->[1] })->to_array;
=head1 SEE ALSO
Expand Down

0 comments on commit 7e9cd70

Please sign in to comment.