Skip to content

Commit

Permalink
Switch flatMap to compactMap
Browse files Browse the repository at this point in the history
  • Loading branch information
freak4pc authored and kzaher committed Jun 8, 2018
1 parent c5078ec commit 2e3f6b4
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct WikipediaSearchResult: CustomDebugStringConvertible {

// tedious parsing part
static func parseJSON(_ json: [AnyObject]) throws -> [WikipediaSearchResult] {
let rootArrayTyped: [[AnyObject]] = json.flatMap { $0 as? [AnyObject] }
let rootArrayTyped = json.compactMap { $0 as? [AnyObject] }

guard rootArrayTyped.count == 3 else {
throw WikipediaParseError
Expand Down

0 comments on commit 2e3f6b4

Please sign in to comment.