Skip to content

Commit

Permalink
Merge pull request #29 from hyperoslo/improve/comparison
Browse files Browse the repository at this point in the history
Add != and !== for collection of items
  • Loading branch information
vadymmarkov authored Dec 21, 2016
2 parents 344ab16 + 80b742e commit a86769d
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Sources/Shared/Item.swift
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,17 @@ public func ==(lhs: Item, rhs: Item) -> Bool {
compareRelations(lhs, rhs)
}

/**
Item Equatable implementation
- parameter lhs: Left hand Item
- parameter rhs: Right hand Item

- returns: A boolean value, true if both Item are not equal
*/
public func != (lhs: [Item], rhs: [Item]) -> Bool {
return !(lhs == rhs)
}

/**
Check if Item's are truly equal by including size in comparison

Expand All @@ -342,6 +353,16 @@ public func ===(lhs: Item, rhs: Item) -> Bool {
return equal
}

/**
A collection of Item Equatable implementation to see if they are truly not equal
- parameter lhs: Left hand collection of Items
- parameter rhs: Right hand collection of Items
- returns: A boolean value, true if both Item are not equal
*/
public func !== (lhs: [Item], rhs: [Item]) -> Bool {
return !(lhs === rhs)
}

/**
A reverse Equatable implementation for comparing Item's
- parameter lhs: Left hand Item
Expand Down

0 comments on commit a86769d

Please sign in to comment.