Fixed using spaces in filter expressions and variables lists (#178)

* fixed using spaces in filter expression

* fixed breaking variables lists and filters by spaces

* simplified smartJoin

* avoid force unwrap
This commit is contained in:
Ilya Puchka
2018-05-13 01:06:38 +01:00
committed by GitHub
parent d935f65d56
commit 39ed9aa753
6 changed files with 32 additions and 11 deletions

View File

@@ -209,11 +209,11 @@ extension Dictionary : Normalizable {
func parseFilterComponents(token: String) -> (String, [Variable]) {
var components = token.smartSplit(separator: ":")
let name = components.removeFirst()
let name = components.removeFirst().trim(character: " ")
let variables = components
.joined(separator: ":")
.smartSplit(separator: ",")
.map { Variable($0) }
.map { Variable($0.trim(character: " ")) }
return (name, variables)
}