Skip to content

Commit

Permalink
优化日志
Browse files Browse the repository at this point in the history
  • Loading branch information
Mccc committed Aug 20, 2024
1 parent 7de0a0d commit 14077e1
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,9 @@ extension JSONDecoderImpl.KeyedContainer {
extension JSONDecoderImpl.KeyedContainer {

func decodeIfPresent(_ type: Bool.Type, forKey key: K) throws -> Bool? {
guard let value = try? getValue(forKey: key) else { return nil }
guard let value = try? getValue(forKey: key) else {
return optionalDecode(forKey: key)
}

if let decoded = impl.cache.tranform(value: value, for: key) as? Bool {
return decoded
Expand All @@ -331,7 +333,9 @@ extension JSONDecoderImpl.KeyedContainer {
}

func decodeIfPresent(_ type: String.Type, forKey key: K) throws -> String? {
guard let value = try? getValue(forKey: key) else { return nil }
guard let value = try? getValue(forKey: key) else {
return optionalDecode(forKey: key)
}

if let decoded = impl.cache.tranform(value: value, for: key) as? String {
return decoded
Expand Down

0 comments on commit 14077e1

Please sign in to comment.