mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
821 B
C
28 lines
821 B
C
5 years ago
|
//
|
||
|
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
|
||
|
//
|
||
|
|
||
|
#import <Foundation/Foundation.h>
|
||
|
|
||
|
NS_ASSUME_NONNULL_BEGIN
|
||
|
|
||
|
@interface NSArray (FunctionalUtil)
|
||
|
|
||
|
/// Returns true when any of the items in this array match the given predicate.
|
||
|
- (bool)any:(int (^)(id item))predicate;
|
||
|
|
||
|
/// Returns true when all of the items in this array match the given predicate.
|
||
|
- (bool)all:(int (^)(id item))predicate;
|
||
|
|
||
|
/// Returns an array of all the results of passing items from this array through the given projection function.
|
||
|
- (NSArray *)map:(id (^)(id item))projection;
|
||
|
|
||
|
/// Returns an array of all the results of passing items from this array through the given projection function.
|
||
|
- (NSArray *)filter:(int (^)(id item))predicate;
|
||
|
|
||
|
- (NSDictionary *)groupBy:(id (^)(id value))keySelector;
|
||
|
|
||
|
@end
|
||
|
|
||
|
NS_ASSUME_NONNULL_END
|