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.180 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.179 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.178 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.177 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.176 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.175 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.174 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.173 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.172 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.171 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.170 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.169 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.167 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.166 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.165 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.164 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.163 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.162 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.161 tracks/objective-c/exercises/strain/StrainExample.m
trackler-2.2.1.160 tracks/objective-c/exercises/strain/StrainExample.m