feat(default filter): Support multiple defaults

This commit is contained in:
Kyle Fuller
2016-11-28 19:10:48 +00:00
parent 679344f53b
commit b1da85b140
2 changed files with 17 additions and 1 deletions

View File

@@ -33,7 +33,17 @@ func lowercase(_ value: Any?) -> Any? {
}
func defaultFilter(value: Any?, arguments: [Any?]) -> Any? {
return value ?? arguments.first as Any
if let value = value {
return value
}
for argument in arguments {
if let argument = argument {
return argument
}
}
return nil
}
func joinFilter(value: Any?, arguments: [Any?]) throws -> Any? {