At least for the functional mindset. A short one-liner should be more
readable than an if-else.

Signed-off-by: Stephen Celis <stephen@stephencelis.com>
This commit is contained in:
Stephen Celis 2015-05-13 19:45:08 -04:00
Родитель 6d9fb5c6ea
Коммит 17e0f96d8b
1 изменённых файлов: 1 добавлений и 5 удалений

Просмотреть файл

@ -273,11 +273,7 @@ public struct Query {
// prevents limit(nil, offset: 5)
private func limit(#to: Int?, offset: Int? = nil) -> Query {
var query = self
if let to = to {
query.limit = (to, offset)
} else {
query.limit = nil
}
query.limit = to.map { ($0, offset) }
return query
}