added == and != to existing
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
fba2e80b8a
commit
b219f3f75d
@ -109,3 +109,43 @@ public extension Optional {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func == (lhs: (any ModelComparisonProtocol)?, rhs: (any ModelComparisonProtocol)?) -> Bool {
|
||||||
|
switch (lhs, rhs) {
|
||||||
|
case (.some(let lhs), .some(let rhs)):
|
||||||
|
return lhs.isEqual(to: rhs)
|
||||||
|
case (.none, .none):
|
||||||
|
return true
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func != (lhs: (any ModelComparisonProtocol)?, rhs: (any ModelComparisonProtocol)?) -> Bool {
|
||||||
|
return !(lhs == rhs)
|
||||||
|
}
|
||||||
|
|
||||||
|
func == (lhs: [any ModelComparisonProtocol]?, rhs: [any ModelComparisonProtocol]?) -> Bool {
|
||||||
|
switch (lhs, rhs) {
|
||||||
|
case (.some(let lhs), .some(let rhs)):
|
||||||
|
return lhs == rhs
|
||||||
|
case (.none, .none):
|
||||||
|
return true
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func != (lhs: [any ModelComparisonProtocol]?, rhs: [any ModelComparisonProtocol]?) -> Bool {
|
||||||
|
return !(lhs == rhs)
|
||||||
|
}
|
||||||
|
|
||||||
|
func == (lhs: [any ModelComparisonProtocol], rhs: [any ModelComparisonProtocol]) -> Bool {
|
||||||
|
return lhs.elementsEqual(rhs, by: { (lhsElement, rhsElement) -> Bool in
|
||||||
|
return lhsElement == rhsElement
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func != (lhs: [any ModelComparisonProtocol], rhs: [any ModelComparisonProtocol]) -> Bool {
|
||||||
|
return !(lhs == rhs)
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user