Skip to content

Commit

Permalink
Update documentation for NSSet+without
Browse files Browse the repository at this point in the history
  • Loading branch information
kdubb committed Apr 25, 2016
1 parent 35d4708 commit 1b16b3c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions NSSet+without.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
@interface NSSet (YOLOWithout)

/**
Returns a new array where objects in the given array are removed from
the receiver.
Returns a new set where objects in the given set/array/object
are removed from the receiver.
id rv = @[@1, @2, @3, @4, @5, @6].without(@2);
// rv => @[@1, @3, @4, @5, @6]
Expand Down
14 changes: 7 additions & 7 deletions NSSet+without.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
@implementation NSSet (YOLOWithout)

- (NSSet *(^)(id))without {
return ^NSSet *(id arrayOrSet) {
if (!arrayOrSet)
return ^NSSet *(id arrayOrSetOrObject) {
if (!arrayOrSetOrObject)
return self;

id objs = [arrayOrSet isKindOfClass:[NSSet class]]
? [arrayOrSet allObjects]
: [arrayOrSet isKindOfClass:[NSArray class]]
? arrayOrSet
: @[arrayOrSet];
id objs = [arrayOrSetOrObject isKindOfClass:[NSSet class]]
? [arrayOrSetOrObject allObjects]
: [arrayOrSetOrObject isKindOfClass:[NSArray class]]
? arrayOrSetOrObject
: @[arrayOrSetOrObject];
id rv = self.mutableCopy;
[rv removeObjectsInArray:objs];
return rv;
Expand Down

0 comments on commit 1b16b3c

Please sign in to comment.