Skip to content

Commit

Permalink
ComparisonResult: Added inverted property
Browse files Browse the repository at this point in the history
  • Loading branch information
orchetect committed Dec 24, 2024
1 parent 5244ca1 commit bc5deb5
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// Collections and Foundation.swift
// OTCore • https://github.com/orchetect/OTCore
// © 2024 Steffan Andrews • Licensed under MIT License
//

#if canImport(Foundation)

import Foundation

// MARK: - Comparison

extension ComparisonResult {
/// **OTCore:**
/// Returns the inverted comparison result.
@inlinable @_disfavoredOverload
public var inverted: Self {
switch self {
case .orderedAscending: .orderedDescending
case .orderedSame: .orderedSame
case .orderedDescending: .orderedAscending
}
}
}

#endif

0 comments on commit bc5deb5

Please sign in to comment.