Skip to content

Commit

Permalink
Update map and ! to compact map and ?
Browse files Browse the repository at this point in the history
  • Loading branch information
Truba committed Nov 15, 2019
1 parent 5e77e15 commit bfab815
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Japx/Classes/Core/Japx.swift
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,7 @@ private extension Japx.Decoder {
parseNotIncludedRelationships: options.parseNotIncludedRelationships
)

//Force cast here is ok since it is taken from include list string
let relationships = try paramsDict.allKeys.map({ $0 as! String }).reduce(into: Parameters(), { (result, relationshipsKey) in
let relationships = try paramsDict.allKeys.compactMap({ $0 as? String }).reduce(into: Parameters(), { (result, relationshipsKey) in
guard let relationship = relationshipsReferences.asDictionary(from: relationshipsKey) else { return }
guard let otherObjectsData = try relationship.array(from: Consts.APIKeys.data) else {
result[relationshipsKey] = NSNull()
Expand Down

0 comments on commit bfab815

Please sign in to comment.