react-native-fs/NSArray+Map.m

17 lines
387 B
Objective-C

//
// NSArray+Map.m
// RNFS
#import "NSArray+Map.h"
@implementation NSArray (Map)
- (NSArray *)rnfs_mapObjectsUsingBlock:(id (^)(id obj, NSUInteger idx))block {
NSMutableArray *result = [NSMutableArray arrayWithCapacity:[self count]];
[self enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
[result addObject:block(obj, idx)];
}];
return result;
}
@end