Added stringEncoding parameter to Future<Data>.csvTo method

This commit is contained in:
Caleb Kleveter 2018-05-08 16:07:24 -05:00
parent dd2c8c2f52
commit ccf07c6ca6
No known key found for this signature in database
GPG Key ID: 30A5A6F3A0ED7EDA
1 changed files with 2 additions and 2 deletions

View File

@ -20,9 +20,9 @@ extension Future where T == Data {
}
}
public func csvTo<T>(_ type: T.Type) -> Future<[T]> where T: Decodable {
public func csvTo<T>(_ type: T.Type, stringEncoding: String.Encoding = .utf8) -> Future<[T]> where T: Decodable {
return self.map(to: [T].self) { (data) in
return try _CSVDecoder.decode(T.self, from: data)
return try _CSVDecoder.decode(T.self, from: data, stringDecoding: stringEncoding)
}
}
}