mirror of
https://github.com/yattee/yattee.git
synced 2024-11-14 01:58:24 +00:00
8 lines
168 B
Swift
8 lines
168 B
Swift
|
import Foundation
|
||
|
|
||
|
extension Comparable {
|
||
|
func clamped(to limits: ClosedRange<Self>) -> Self {
|
||
|
min(max(self, limits.lowerBound), limits.upperBound)
|
||
|
}
|
||
|
}
|