Sha256: 6aecc49fc06dd4acf8a2ac7d5375d8ae7d5126ea6b9ed029d2c2a0453ce82eb9

Contents?: true

Size: 739 Bytes

Versions: 60

Compression:

Stored size: 739 Bytes

Contents

#import <Foundation/Foundation.h>
#import "StrainExample.h"

NS_ASSUME_NONNULL_BEGIN

@implementation NSArray (StrainExample)

-(instancetype)keep:(BOOL)compare where:(BOOL (^)(id))completionHandler{
    
    NSMutableArray *filteredArray = [NSMutableArray array];
    
    for(int index = 0;index < self.count;index++){
        
        id objectInArray = self[index];
        
        BOOL flag = completionHandler(objectInArray);
        
        if(flag == compare){
            
            [filteredArray addObject:objectInArray];
        }
    }
    
    return filteredArray;
    
}

-(instancetype)discard:(BOOL (^)(id))completionHandler{
    
    return [self keep:false where:completionHandler];
}


@end

NS_ASSUME_NONNULL_END

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
trackler-2.2.1.139 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.138 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.137 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.136 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.135 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.134 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.133 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.132 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.131 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.130 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.129 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.128 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.127 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.126 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.125 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.124 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.123 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.122 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.121 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.120 tracks/objective-c/exercises/strain/StrainExample.m