Skip to content

Commit

Permalink
finish documenting list methods
Browse files Browse the repository at this point in the history
  • Loading branch information
tobyink committed Sep 20, 2020
1 parent d090e3c commit 47b21d6
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/Type/Tiny.pm
Expand Up @@ -2142,14 +2142,35 @@ C<StrictNum>, C<LaxNum>, and C<Enum> type constraints include sorters.
=item C<< rsort(@list) >>
Like C<sort> but backwards.
=item C<< any(@list) >>
Returns true if any of the list match the type.
if ( Int->any(@numbers) ) {
say "there was at least one integer";
}
=item C<< all(@list) >>
Returns true if all of the list match the type.
if ( Int->any(@numbers) ) {
say "they were all integers";
}
=item C<< assert_any(@list) >>
Like C<any> but instead of returning a boolean, returns the entire original
list if any item on it matches the type, and dies if none does.
=item C<< assert_all(@list) >>
Like C<all> but instead of returning a boolean, returns the original list if
all items on it match the type, but dies as soon as it finds one that does
not.
=back
=head3 Inlining methods
Expand Down

0 comments on commit 47b21d6

Please sign in to comment.