0001 http://www.apache.org/licenses/LICENSE-2.0http://opensource.org/licenses/MIT
0015
0017 public enum JSONError| DecimalNumber.swift:52 | default: throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) |
| DecimalNumber.swift:64 | default: throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) |
| DecimalNumber.swift:76 | throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) |
| DecimalNumber.swift:90 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Number), actual: .forValue(self)) } |
| JSONError.swift:45 | private func withPrefix(prefix: String) -> JSONError { |
| JSONError.swift:107 | guard let b = bool else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Bool), actual: .forValue(self)) } |
| JSONError.swift:117 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Bool), actual: .forValue(self)) } |
| JSONError.swift:124 | guard let str = string else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.String), actual: .forValue(self)) } |
| JSONError.swift:134 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.String), actual: .forValue(self)) } |
| JSONError.swift:141 | guard let val = int64 else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) } |
| JSONError.swift:151 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Number), actual: .forValue(self)) } |
| JSONError.swift:159 | guard let val = int64 else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) } |
| JSONError.swift:161 | guard Swift.Int64(truncated) == val else { throw JSONError.OutOfRangeInt64(path: nil, value: val, expected: Int.self) } |
| JSONError.swift:172 | guard Swift.Int64(truncated) == val else { throw JSONError.OutOfRangeInt64(path: nil, value: val, expected: Int.self) } |
| JSONError.swift:175 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Number), actual: .forValue(self)) } |
| JSONError.swift:182 | guard let val = double else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) } |
| JSONError.swift:192 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Number), actual: .forValue(self)) } |
| JSONError.swift:199 | guard let dict = object else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Object), actual: .forValue(self)) } |
| JSONError.swift:209 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Object), actual: .forValue(self)) } |
| JSONError.swift:216 | guard let ary = array else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Array), actual: .forValue(self)) } |
| JSONError.swift:226 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Array), actual: .forValue(self)) } |
| JSONError.swift:245 | private func toStringMaybeNil(expected: JSONError.ExpectedType) throws -> Swift.String? { |
| JSONError.swift:252 | default: throw JSONError.MissingOrInvalidType(path: nil, expected: expected, actual: .forValue(self)) |
| JSONError.swift:265 | throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .Null) |
| JSONError.swift:281 | private func toInt64MaybeNil(expected: JSONError.ExpectedType) throws -> Swift.Int64? { |
| JSONError.swift:287 | throw JSONError.OutOfRangeDouble(path: nil, value: d, expected: Swift.Int64.self) |
| JSONError.swift:295 | throw JSONError.OutOfRangeDouble(path: nil, value: d, expected: Swift.Int64.self) |
| JSONError.swift:304 | throw JSONError.MissingOrInvalidType(path: nil, expected: expected, actual: .forValue(self)) |
| JSONError.swift:317 | guard Swift.Int64(truncated) == val else { throw JSONError.OutOfRangeInt64(path: nil, value: val, expected: Int.self) } |
| JSONError.swift:331 | guard Swift.Int64(truncated) == val else { throw JSONError.OutOfRangeInt64(path: nil, value: val, expected: Int.self) } |
| JSONError.swift:341 | throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .Null) |
| JSONError.swift:354 | private func toDoubleMaybeNil(expected: JSONError.ExpectedType) throws -> Swift.Double? { |
| JSONError.swift:360 | default: throw JSONError.MissingOrInvalidType(path: nil, expected: expected, actual: .forValue(self)) |
| JSONError.swift:1293 | internal func getRequired(dict: JSONObject, key: String, type: JSONError.JSONType) throws -> JSON { |
| JSONError.swift:1294 | guard let value = dict[key] else { throw JSONError.MissingOrInvalidType(path: key, expected: .Required(type), actual: nil) } |
| JSONError.swift:1298 | internal func getRequired(ary: JSONArray, index: Int, type: JSONError.JSONType) throws -> JSON { |
| JSONError.swift:1299 | guard let value = ary[safe: index] else { throw JSONError.MissingOrInvalidType(path: "[\(index)]", expected: .Required(type), actual: nil) } |
| JSONError.swift:1307 | } catch let error as JSONError { |
| JSONError.swift:1316 | } catch let error as JSONError { |
: ErrorType, CustomStringConvertible {
0019 Parameter Parameter Parameter case MissingOrInvalidType| DecimalNumber.swift:52 | default: throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) |
| DecimalNumber.swift:64 | default: throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) |
| DecimalNumber.swift:76 | throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) |
| DecimalNumber.swift:90 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Number), actual: .forValue(self)) } |
| JSONError.swift:39 | case let .MissingOrInvalidType(path, expected, actual): return "\(path.map({$0+": "}) ?? "")expected \(expected), found \(actual?.description ?? "missing value")" |
| JSONError.swift:55 | case let .MissingOrInvalidType(path, expected, actual): |
| JSONError.swift:56 | return .MissingOrInvalidType(path: prefixPath(path, with: prefix), expected: expected, actual: actual) |
| JSONError.swift:107 | guard let b = bool else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Bool), actual: .forValue(self)) } |
| JSONError.swift:117 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Bool), actual: .forValue(self)) } |
| JSONError.swift:124 | guard let str = string else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.String), actual: .forValue(self)) } |
| JSONError.swift:134 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.String), actual: .forValue(self)) } |
| JSONError.swift:141 | guard let val = int64 else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) } |
| JSONError.swift:151 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Number), actual: .forValue(self)) } |
| JSONError.swift:159 | guard let val = int64 else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) } |
| JSONError.swift:175 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Number), actual: .forValue(self)) } |
| JSONError.swift:182 | guard let val = double else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) } |
| JSONError.swift:192 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Number), actual: .forValue(self)) } |
| JSONError.swift:199 | guard let dict = object else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Object), actual: .forValue(self)) } |
| JSONError.swift:209 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Object), actual: .forValue(self)) } |
| JSONError.swift:216 | guard let ary = array else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Array), actual: .forValue(self)) } |
| JSONError.swift:226 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Array), actual: .forValue(self)) } |
| JSONError.swift:252 | default: throw JSONError.MissingOrInvalidType(path: nil, expected: expected, actual: .forValue(self)) |
| JSONError.swift:265 | throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .Null) |
| JSONError.swift:304 | throw JSONError.MissingOrInvalidType(path: nil, expected: expected, actual: .forValue(self)) |
| JSONError.swift:341 | throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .Null) |
| JSONError.swift:360 | default: throw JSONError.MissingOrInvalidType(path: nil, expected: expected, actual: .forValue(self)) |
| JSONError.swift:1294 | guard let value = dict[key] else { throw JSONError.MissingOrInvalidType(path: key, expected: .Required(type), actual: nil) } |
| JSONError.swift:1299 | guard let value = ary[safe: index] else { throw JSONError.MissingOrInvalidType(path: "[\(index)]", expected: .Required(type), actual: nil) } |
(path: String?, expected: ExpectedType, actual: JSONType?)
0024 Parameter Parameter Parameter case OutOfRangeInt64| JSONError.swift:40 | case let .OutOfRangeInt64(path, value, expected): return "\(path.map({$0+": "}) ?? "")value \(value) cannot be coerced to type \(expected)" |
| JSONError.swift:57 | case let .OutOfRangeInt64(path, value, expected): |
| JSONError.swift:58 | return .OutOfRangeInt64(path: prefixPath(path, with: prefix), value: value, expected: expected) |
| JSONError.swift:161 | guard Swift.Int64(truncated) == val else { throw JSONError.OutOfRangeInt64(path: nil, value: val, expected: Int.self) } |
| JSONError.swift:172 | guard Swift.Int64(truncated) == val else { throw JSONError.OutOfRangeInt64(path: nil, value: val, expected: Int.self) } |
| JSONError.swift:317 | guard Swift.Int64(truncated) == val else { throw JSONError.OutOfRangeInt64(path: nil, value: val, expected: Int.self) } |
| JSONError.swift:331 | guard Swift.Int64(truncated) == val else { throw JSONError.OutOfRangeInt64(path: nil, value: val, expected: Int.self) } |
(path: String?, value: Int64, expected: Any.Type)
0030 Parameter Parameter Parameter case OutOfRangeDouble| JSONError.swift:41 | case let .OutOfRangeDouble(path, value, expected): return "\(path.map({$0+": "}) ?? "")value \(value) cannot be coerced to type \(expected)" |
| JSONError.swift:59 | case let .OutOfRangeDouble(path, value, expected): |
| JSONError.swift:60 | return .OutOfRangeDouble(path: prefixPath(path, with: prefix), value: value, expected: expected) |
| JSONError.swift:287 | throw JSONError.OutOfRangeDouble(path: nil, value: d, expected: Swift.Int64.self) |
| JSONError.swift:295 | throw JSONError.OutOfRangeDouble(path: nil, value: d, expected: Swift.Int64.self) |
(path: String?, value: Double, expected: Any.Type)
0036
0037 public var description: String {
0038 switch self {
0039 case let .MissingOrInvalidType(path, expected, actual): return "\(path.map({$0+": "}) ?? "")expected \(expected), found \(actual?.description ?? "missing value")"
0040 case let .OutOfRangeInt64(path, value, expected): return "\(path.map({$0+": "}) ?? "")value \(value) cannot be coerced to type \(expected)"
0041 case let .OutOfRangeDouble(path, value, expected): return "\(path.map({$0+": "}) ?? "")value \(value) cannot be coerced to type \(expected)"
0042 }
0043 }
0044
0045 private func withPrefix| JSONError.swift:1308 | throw error.withPrefix(key) |
| JSONError.swift:1317 | throw error.withPrefix("[\(index)]") |
(prefix: String) -> JSONError {
0046 func prefixPath(path: String?, with prefix: String) -> String {
0047 guard let path = path where !path.isEmpty else { return prefix }
0048 if path.unicodeScalars.first == "[" {
0049 return prefix + path
0050 } else {
0051 return "\(prefix).\(path)"
0052 }
0053 }
0054 switch self {
0055 case let .MissingOrInvalidType(path, expected, actual):
0056 return .MissingOrInvalidType(path: prefixPath(path, with: prefix), expected: expected, actual: actual)
0057 case let .OutOfRangeInt64(path, value, expected):
0058 return .OutOfRangeInt64(path: prefixPath(path, with: prefix), value: value, expected: expected)
0059 case let .OutOfRangeDouble(path, value, expected):
0060 return .OutOfRangeDouble(path: prefixPath(path, with: prefix), value: value, expected: expected)
0061 }
0062 }
0063
0064 public enum ExpectedType| JSONError.swift:23 | case MissingOrInvalidType(path: String?, expected: ExpectedType, actual: JSONType?) |
| JSONError.swift:245 | private func toStringMaybeNil(expected: JSONError.ExpectedType) throws -> Swift.String? { |
| JSONError.swift:281 | private func toInt64MaybeNil(expected: JSONError.ExpectedType) throws -> Swift.Int64? { |
| JSONError.swift:354 | private func toDoubleMaybeNil(expected: JSONError.ExpectedType) throws -> Swift.Double? { |
: CustomStringConvertible {
0065 case Required| DecimalNumber.swift:52 | default: throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) |
| DecimalNumber.swift:64 | default: throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) |
| DecimalNumber.swift:76 | throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) |
| JSONError.swift:70 | case .Required(let type): return type.description |
| JSONError.swift:107 | guard let b = bool else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Bool), actual: .forValue(self)) } |
| JSONError.swift:124 | guard let str = string else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.String), actual: .forValue(self)) } |
| JSONError.swift:141 | guard let val = int64 else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) } |
| JSONError.swift:159 | guard let val = int64 else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) } |
| JSONError.swift:182 | guard let val = double else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) } |
| JSONError.swift:199 | guard let dict = object else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Object), actual: .forValue(self)) } |
| JSONError.swift:216 | guard let ary = array else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Array), actual: .forValue(self)) } |
| JSONError.swift:235 | return try toStringMaybeNil(.Required(.String)) ?? "null" |
| JSONError.swift:264 | guard let val = try toInt64MaybeNil(.Required(.Number)) else { |
| JSONError.swift:265 | throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .Null) |
| JSONError.swift:340 | guard let val = try toDoubleMaybeNil(.Required(.Number)) else { |
| JSONError.swift:341 | throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .Null) |
| JSONError.swift:1294 | guard let value = dict[key] else { throw JSONError.MissingOrInvalidType(path: key, expected: .Required(type), actual: nil) } |
| JSONError.swift:1299 | guard let value = ary[safe: index] else { throw JSONError.MissingOrInvalidType(path: "[\(index)]", expected: .Required(type), actual: nil) } |
(JSONType)
0066 case Optional| DecimalNumber.swift:90 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Number), actual: .forValue(self)) } |
| JSONError.swift:71 | case .Optional(let type): return "\(type) or null" |
| JSONError.swift:117 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Bool), actual: .forValue(self)) } |
| JSONError.swift:134 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.String), actual: .forValue(self)) } |
| JSONError.swift:151 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Number), actual: .forValue(self)) } |
| JSONError.swift:175 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Number), actual: .forValue(self)) } |
| JSONError.swift:192 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Number), actual: .forValue(self)) } |
| JSONError.swift:209 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Object), actual: .forValue(self)) } |
| JSONError.swift:226 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Array), actual: .forValue(self)) } |
| JSONError.swift:242 | return try toStringMaybeNil(.Optional(.String)) |
| JSONError.swift:278 | return try toInt64MaybeNil(.Optional(.Number)) |
| JSONError.swift:351 | return try toDoubleMaybeNil(.Optional(.Number)) |
(JSONType)
0067
0068 public var description: String {
0069 switch self {
0070 case .Required(let type): return type.description
0071 case .Optional(let type): return "\(type) or null"
0072 }
0073 }
0074 }
0075
0076 public enum JSONType| JSONError.swift:23 | case MissingOrInvalidType(path: String?, expected: ExpectedType, actual: JSONType?) |
| JSONError.swift:65 | case Required(JSONType) |
| JSONError.swift:66 | case Optional(JSONType) |
| JSONError.swift:84 | internal static func forValue(value: JSON) -> JSONType { |
| JSONError.swift:1293 | internal func getRequired(dict: JSONObject, key: String, type: JSONError.JSONType) throws -> JSON { |
| JSONError.swift:1298 | internal func getRequired(ary: JSONArray, index: Int, type: JSONError.JSONType) throws -> JSON { |
: String, CustomStringConvertible {
0077 case Null| JSONError.swift:86 | case .Null: return .Null |
| JSONError.swift:265 | throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .Null) |
| JSONError.swift:341 | throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .Null) |
= "null"
0078 case Bool| JSONError.swift:87 | case .Bool: return .Bool |
| JSONError.swift:107 | guard let b = bool else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Bool), actual: .forValue(self)) } |
| JSONError.swift:117 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Bool), actual: .forValue(self)) } |
| JSONError.swift:669 | let value = try getRequired(ary, index: index, type: .Bool) |
= "bool"
0079 case String| JSONError.swift:88 | case .String: return .String |
| JSONError.swift:124 | guard let str = string else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.String), actual: .forValue(self)) } |
| JSONError.swift:134 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.String), actual: .forValue(self)) } |
| JSONError.swift:235 | return try toStringMaybeNil(.Required(.String)) ?? "null" |
| JSONError.swift:242 | return try toStringMaybeNil(.Optional(.String)) |
| JSONError.swift:374 | let value = try getRequired(dict, key: key, type: .String) |
| JSONError.swift:395 | let value = try getRequired(dict, key: key, type: .String) |
| JSONError.swift:573 | let value = try getRequired(dict, key: key, type: .String) |
| JSONError.swift:690 | let value = try getRequired(ary, index: index, type: .String) |
| JSONError.swift:873 | let value = try getRequired(ary, index: index, type: .String) |
| JSONError.swift:974 | let value = try getRequired(self, key: key, type: .String) |
| JSONError.swift:992 | let value = try getRequired(self, key: key, type: .String) |
| JSONError.swift:1155 | let value = try getRequired(self, key: key, type: .String) |
= "string"
0080 case Number| DecimalNumber.swift:52 | default: throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) |
| DecimalNumber.swift:64 | default: throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) |
| DecimalNumber.swift:76 | throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) |
| DecimalNumber.swift:90 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Number), actual: .forValue(self)) } |
| DecimalNumber.swift:104 | let value = try getRequired(dict, key: key, type: .Number) |
| DecimalNumber.swift:127 | let value = try getRequired(dict, key: key, type: .Number) |
| DecimalNumber.swift:153 | let value = try getRequired(array, index: index, type: .Number) |
| DecimalNumber.swift:175 | let value = try getRequired(array, index: index, type: .Number) |
| DecimalNumber.swift:200 | let value = try getRequired(self, key: key, type: .Number) |
| DecimalNumber.swift:221 | let value = try getRequired(self, key: key, type: .Number) |
| JSONError.swift:89 | case .Int64, .Double: return .Number |
| JSONError.swift:141 | guard let val = int64 else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) } |
| JSONError.swift:151 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Number), actual: .forValue(self)) } |
| JSONError.swift:159 | guard let val = int64 else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) } |
| JSONError.swift:175 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Number), actual: .forValue(self)) } |
| JSONError.swift:182 | guard let val = double else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) } |
| JSONError.swift:192 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Number), actual: .forValue(self)) } |
| JSONError.swift:264 | guard let val = try toInt64MaybeNil(.Required(.Number)) else { |
| JSONError.swift:265 | throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .Null) |
| JSONError.swift:278 | return try toInt64MaybeNil(.Optional(.Number)) |
| JSONError.swift:340 | guard let val = try toDoubleMaybeNil(.Required(.Number)) else { |
| JSONError.swift:341 | throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .Null) |
| JSONError.swift:351 | return try toDoubleMaybeNil(.Optional(.Number)) |
| JSONError.swift:416 | let value = try getRequired(dict, key: key, type: .Number) |
| JSONError.swift:438 | let value = try getRequired(dict, key: key, type: .Number) |
| JSONError.swift:460 | let value = try getRequired(dict, key: key, type: .Number) |
| JSONError.swift:596 | let value = try getRequired(dict, key: key, type: .Number) |
| JSONError.swift:620 | let value = try getRequired(dict, key: key, type: .Number) |
| JSONError.swift:644 | let value = try getRequired(dict, key: key, type: .Number) |
| JSONError.swift:711 | let value = try getRequired(ary, index: index, type: .Number) |
| JSONError.swift:733 | let value = try getRequired(ary, index: index, type: .Number) |
| JSONError.swift:755 | let value = try getRequired(ary, index: index, type: .Number) |
| JSONError.swift:897 | let value = try getRequired(ary, index: index, type: .Number) |
| JSONError.swift:923 | let value = try getRequired(ary, index: index, type: .Number) |
| JSONError.swift:949 | let value = try getRequired(ary, index: index, type: .Number) |
| JSONError.swift:1010 | let value = try getRequired(self, key: key, type: .Number) |
| JSONError.swift:1029 | let value = try getRequired(self, key: key, type: .Number) |
| JSONError.swift:1048 | let value = try getRequired(self, key: key, type: .Number) |
| JSONError.swift:1176 | let value = try getRequired(self, key: key, type: .Number) |
| JSONError.swift:1198 | let value = try getRequired(self, key: key, type: .Number) |
| JSONError.swift:1220 | let value = try getRequired(self, key: key, type: .Number) |
= "number"
0081 case Object| JSONError.swift:90 | case .Object: return .Object |
| JSONError.swift:199 | guard let dict = object else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Object), actual: .forValue(self)) } |
| JSONError.swift:209 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Object), actual: .forValue(self)) } |
| JSONError.swift:800 | let value = try getRequired(ary, index: index, type: .Object) |
| JSONError.swift:1090 | let value = try getRequired(self, key: key, type: .Object) |
= "object"
0082 case Array| JSONError.swift:91 | case .Array: return .Array |
| JSONError.swift:216 | guard let ary = array else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Array), actual: .forValue(self)) } |
| JSONError.swift:226 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Array), actual: .forValue(self)) } |
| JSONError.swift:547 | let value = try getRequired(dict, key: key, type: .Array) |
| JSONError.swift:847 | let value = try getRequired(ary, index: index, type: .Array) |
| JSONError.swift:1132 | let value = try getRequired(self, key: key, type: .Array) |
= "array"
0083
0084 internal static func forValue| DecimalNumber.swift:52 | default: throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) |
| DecimalNumber.swift:64 | default: throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) |
| DecimalNumber.swift:76 | throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) |
| DecimalNumber.swift:90 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Number), actual: .forValue(self)) } |
| JSONError.swift:107 | guard let b = bool else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Bool), actual: .forValue(self)) } |
| JSONError.swift:117 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Bool), actual: .forValue(self)) } |
| JSONError.swift:124 | guard let str = string else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.String), actual: .forValue(self)) } |
| JSONError.swift:134 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.String), actual: .forValue(self)) } |
| JSONError.swift:141 | guard let val = int64 else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) } |
| JSONError.swift:151 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Number), actual: .forValue(self)) } |
| JSONError.swift:159 | guard let val = int64 else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) } |
| JSONError.swift:175 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Number), actual: .forValue(self)) } |
| JSONError.swift:182 | guard let val = double else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) } |
| JSONError.swift:192 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Number), actual: .forValue(self)) } |
| JSONError.swift:199 | guard let dict = object else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Object), actual: .forValue(self)) } |
| JSONError.swift:209 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Object), actual: .forValue(self)) } |
| JSONError.swift:216 | guard let ary = array else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Array), actual: .forValue(self)) } |
| JSONError.swift:226 | else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Array), actual: .forValue(self)) } |
| JSONError.swift:252 | default: throw JSONError.MissingOrInvalidType(path: nil, expected: expected, actual: .forValue(self)) |
| JSONError.swift:304 | throw JSONError.MissingOrInvalidType(path: nil, expected: expected, actual: .forValue(self)) |
| JSONError.swift:360 | default: throw JSONError.MissingOrInvalidType(path: nil, expected: expected, actual: .forValue(self)) |
(value: JSON) -> JSONType {
0085 switch value {
0086 case .Null: return .Null
0087 case .Bool: return .Bool
0088 case .String: return .String
0089 case .Int64, .Double: return .Number
0090 case .Object: return .Object
0091 case .Array: return .Array
0092 }
0093 }
0094
0095 public var description| JSONError.swift:39 | case let .MissingOrInvalidType(path, expected, actual): return "\(path.map({$0+": "}) ?? "")expected \(expected), found \(actual?.description ?? "missing value")" |
| JSONError.swift:70 | case .Required(let type): return type.description |
: Swift.String {
0096 return rawValue
0097 }
0098 }
0099 }
0100
0101 public extension JSON {
0103 Returns Throws func getBool| JSONError.swift:375 | return try scoped(key) { try value.getBool() } |
| JSONError.swift:670 | return try scoped(index) { try value.getBool() } |
| JSONError.swift:975 | return try scoped(key) { try value.getBool() } |
() throws -> Swift.Bool {
0107 guard let b = bool else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Bool), actual: .forValue(self)) }
0108 return b
0109 }
0110
0111 Returns Throws func getBoolOrNil| JSONError.swift:385 | return try scoped(key) { try value.getBoolOrNil() } |
| JSONError.swift:680 | return try scoped(index) { try value.getBoolOrNil() } |
| JSONError.swift:984 | return try scoped(key) { try value.getBoolOrNil() } |
() throws -> Swift.Bool? {
0115 if let b = bool { return b }
0116 else if isNull { return nil }
0117 else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Bool), actual: .forValue(self)) }
0118 }
0119
0120 Returns Throws func getString| JSONError.swift:396 | return try scoped(key) { try value.getString() } |
| JSONError.swift:691 | return try scoped(index) { try value.getString() } |
| JSONError.swift:993 | return try scoped(key) { try value.getString() } |
() throws -> Swift.String {
0124 guard let str = string else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.String), actual: .forValue(self)) }
0125 return str
0126 }
0127
0128 Returns Throws func getStringOrNil| JSONError.swift:406 | return try scoped(key) { try value.getStringOrNil() } |
| JSONError.swift:701 | return try scoped(index) { try value.getStringOrNil() } |
| JSONError.swift:1002 | return try scoped(key) { try value.getStringOrNil() } |
() throws -> Swift.String? {
0132 if let str = string { return str }
0133 else if isNull { return nil }
0134 else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.String), actual: .forValue(self)) }
0135 }
0136
0137 Returns Throws func getInt64| JSONError.swift:417 | return try scoped(key) { try value.getInt64() } |
| JSONError.swift:712 | return try scoped(index) { try value.getInt64() } |
| JSONError.swift:1011 | return try scoped(key) { try value.getInt64() } |
() throws -> Swift.Int64 {
0141 guard let val = int64 else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) }
0142 return val
0143 }
0144
0145 Returns Throws func getInt64OrNil| JSONError.swift:427 | return try scoped(key) { try value.getInt64OrNil() } |
| JSONError.swift:722 | return try scoped(index) { try value.getInt64OrNil() } |
| JSONError.swift:1020 | return try scoped(key) { try value.getInt64OrNil() } |
() throws -> Swift.Int64? {
0149 if let val = int64 { return val }
0150 else if isNull { return nil }
0151 else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Number), actual: .forValue(self)) }
0152 }
0153
0154 Returns Throws func getInt| JSONError.swift:439 | return try scoped(key) { try value.getInt() } |
| JSONError.swift:734 | return try scoped(index) { try value.getInt() } |
| JSONError.swift:1030 | return try scoped(key) { try value.getInt() } |
() throws -> Int {
0159 guard let val = int64 else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) }
0160 let truncated = Int(truncatingBitPattern: val)
0161 guard Swift.Int64(truncated) == val else { throw JSONError.OutOfRangeInt64(path: nil, value: val, expected: Int.self) }
0162 return truncated
0163 }
0164
0165 Returns Throws func getIntOrNil| JSONError.swift:450 | return try scoped(key) { try value.getIntOrNil() } |
| JSONError.swift:745 | return try scoped(index) { try value.getIntOrNil() } |
| JSONError.swift:1040 | return try scoped(key) { try value.getIntOrNil() } |
() throws -> Int? {
0170 if let val = int64 {
0171 let truncated = Int(truncatingBitPattern: val)
0172 guard Swift.Int64(truncated) == val else { throw JSONError.OutOfRangeInt64(path: nil, value: val, expected: Int.self) }
0173 return truncated
0174 } else if isNull { return nil }
0175 else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Number), actual: .forValue(self)) }
0176 }
0177
0178 Returns Throws func getDouble| JSONError.swift:461 | return try scoped(key) { try value.getDouble() } |
| JSONError.swift:756 | return try scoped(index) { try value.getDouble() } |
| JSONError.swift:1049 | return try scoped(key) { try value.getDouble() } |
() throws -> Swift.Double {
0182 guard let val = double else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .forValue(self)) }
0183 return val
0184 }
0185
0186 Returns Throws func getDoubleOrNil| JSONError.swift:471 | return try scoped(key) { try value.getDoubleOrNil() } |
| JSONError.swift:766 | return try scoped(index) { try value.getDoubleOrNil() } |
| JSONError.swift:1058 | return try scoped(key) { try value.getDoubleOrNil() } |
() throws -> Swift.Double? {
0190 if let val = double { return val }
0191 else if isNull { return nil }
0192 else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Number), actual: .forValue(self)) }
0193 }
0194
0195 Returns Throws func getObject| DecimalNumber.swift:103 | let dict = try getObject() |
| DecimalNumber.swift:114 | let dict = try getObject() |
| DecimalNumber.swift:126 | let dict = try getObject() |
| DecimalNumber.swift:137 | let dict = try getObject() |
| JSONError.swift:373 | let dict = try getObject() |
| JSONError.swift:383 | let dict = try getObject() |
| JSONError.swift:394 | let dict = try getObject() |
| JSONError.swift:404 | let dict = try getObject() |
| JSONError.swift:415 | let dict = try getObject() |
| JSONError.swift:425 | let dict = try getObject() |
| JSONError.swift:437 | let dict = try getObject() |
| JSONError.swift:448 | let dict = try getObject() |
| JSONError.swift:459 | let dict = try getObject() |
| JSONError.swift:469 | let dict = try getObject() |
| JSONError.swift:504 | return try getObject().getObject(key, transform) |
| JSONError.swift:514 | return try getObject().getObjectOrNil(key, transform) |
| JSONError.swift:546 | let dict = try getObject() |
| JSONError.swift:558 | let dict = try getObject() |
| JSONError.swift:572 | let dict = try getObject() |
| JSONError.swift:583 | let dict = try getObject() |
| JSONError.swift:595 | let dict = try getObject() |
| JSONError.swift:607 | let dict = try getObject() |
| JSONError.swift:619 | let dict = try getObject() |
| JSONError.swift:631 | let dict = try getObject() |
| JSONError.swift:643 | let dict = try getObject() |
| JSONError.swift:654 | let dict = try getObject() |
| JSONError.swift:801 | return try scoped(index) { try f(value.getObject()) } |
| JSONError.swift:1091 | return try scoped(key) { try f(value.getObject()) } |
() throws -> JSONObject {
0199 guard let dict = object else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Object), actual: .forValue(self)) }
0200 return dict
0201 }
0202
0203 Returns Throws func getObjectOrNil| JSONError.swift:813 | return try scoped(index) { try value.getObjectOrNil().flatMap(f) } |
| JSONError.swift:1101 | return try scoped(key) { try value.getObjectOrNil().flatMap(f) } |
() throws -> JSONObject? {
0207 if let dict = object { return dict }
0208 else if isNull { return nil }
0209 else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Object), actual: .forValue(self)) }
0210 }
0211
0212 Returns Throws func getArray| DecimalNumber.swift:152 | let array = try getArray() |
| DecimalNumber.swift:162 | let array = try getArray() |
| DecimalNumber.swift:174 | let array = try getArray() |
| DecimalNumber.swift:185 | let array = try getArray() |
| JSONError.swift:548 | return try scoped(key) { try transform(value.getArray()) } |
| JSONError.swift:668 | let ary = try getArray() |
| JSONError.swift:678 | let ary = try getArray() |
| JSONError.swift:689 | let ary = try getArray() |
| JSONError.swift:699 | let ary = try getArray() |
| JSONError.swift:710 | let ary = try getArray() |
| JSONError.swift:720 | let ary = try getArray() |
| JSONError.swift:732 | let ary = try getArray() |
| JSONError.swift:743 | let ary = try getArray() |
| JSONError.swift:754 | let ary = try getArray() |
| JSONError.swift:764 | let ary = try getArray() |
| JSONError.swift:799 | let ary = try getArray() |
| JSONError.swift:811 | let ary = try getArray() |
| JSONError.swift:846 | let ary = try getArray() |
| JSONError.swift:848 | return try scoped(index) { try f(value.getArray()) } |
| JSONError.swift:858 | let ary = try getArray() |
| JSONError.swift:872 | let ary = try getArray() |
| JSONError.swift:883 | let ary = try getArray() |
| JSONError.swift:896 | let ary = try getArray() |
| JSONError.swift:909 | let ary = try getArray() |
| JSONError.swift:922 | let ary = try getArray() |
| JSONError.swift:935 | let ary = try getArray() |
| JSONError.swift:948 | let ary = try getArray() |
| JSONError.swift:960 | let ary = try getArray() |
| JSONError.swift:1133 | return try scoped(key) { try f(value.getArray()) } |
() throws -> JSONArray {
0216 guard let ary = array else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Array), actual: .forValue(self)) }
0217 return ary
0218 }
0219
0220 Returns Throws func getArrayOrNil| JSONError.swift:560 | return try scoped(key) { try value.getArrayOrNil().flatMap(transform) } |
| JSONError.swift:860 | return try scoped(index) { try value.getArrayOrNil().flatMap(f) } |
| JSONError.swift:1143 | return try scoped(key) { try value.getArrayOrNil().flatMap(f) } |
() throws -> JSONArray? {
0224 if let ary = array { return ary }
0225 else if isNull { return nil }
0226 else { throw JSONError.MissingOrInvalidType(path: nil, expected: .Optional(.Array), actual: .forValue(self)) }
0227 }
0228 }
0229
0230 public extension JSON {
0231 Returns Throws func toString| Accessors.swift:148 | return try? toString() |
| JSONError.swift:574 | return try scoped(key) { try value.toString() } |
| JSONError.swift:874 | return try scoped(index) { try value.toString() } |
| JSONError.swift:1156 | return try scoped(key) { try value.toString() } |
() throws -> Swift.String {
0235 return try toStringMaybeNil(.Required(.String)) ?? "null"
0236 }
0237
0238 Returns Throws func toStringOrNil| JSONError.swift:585 | return try scoped(key) { try value.toStringOrNil() } |
| JSONError.swift:885 | return try scoped(index) { try value.toStringOrNil() } |
| JSONError.swift:1166 | return try scoped(key) { try value.toStringOrNil() } |
() throws -> Swift.String? {
0242 return try toStringMaybeNil(.Optional(.String))
0243 }
0244
0245 private func toStringMaybeNil| JSONError.swift:235 | return try toStringMaybeNil(.Required(.String)) ?? "null" |
| JSONError.swift:242 | return try toStringMaybeNil(.Optional(.String)) |
(expected: JSONError.ExpectedType) throws -> Swift.String? {
0246 switch self {
0247 case .String(let s): return s
0248 case .Null: return nil
0249 case .Bool(let b): return Swift.String(b)
0250 case .Int64(let i): return Swift.String(i)
0251 case .Double(let d): return Swift.String(d)
0252 default: throw JSONError.MissingOrInvalidType(path: nil, expected: expected, actual: .forValue(self))
0253 }
0254 }
0255
0256 Returns Throws func toInt64| Accessors.swift:157 | return try? toInt64() |
| JSONError.swift:315 | let val = try toInt64() |
| JSONError.swift:597 | return try scoped(key) { try value.toInt64() } |
| JSONError.swift:898 | return try scoped(index) { try value.toInt64() } |
| JSONError.swift:1177 | return try scoped(key) { try value.toInt64() } |
() throws -> Swift.Int64 {
0264 guard let val = try toInt64MaybeNil(.Required(.Number)) else {
0265 throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .Null)
0266 }
0267 return val
0268 }
0269
0270 Returns Throws func toInt64OrNil| JSONError.swift:329 | guard let val = try toInt64OrNil() else { return nil } |
| JSONError.swift:609 | return try scoped(key) { try value.toInt64OrNil() } |
| JSONError.swift:911 | return try scoped(index) { try value.toInt64OrNil() } |
| JSONError.swift:1188 | return try scoped(key) { try value.toInt64OrNil() } |
() throws -> Swift.Int64? {
0278 return try toInt64MaybeNil(.Optional(.Number))
0279 }
0280
0281 private func toInt64MaybeNil| JSONError.swift:264 | guard let val = try toInt64MaybeNil(.Required(.Number)) else { |
| JSONError.swift:278 | return try toInt64MaybeNil(.Optional(.Number)) |
(expected: JSONError.ExpectedType) throws -> Swift.Int64? {
0282 switch self {
0283 case .Int64(let i):
0284 return i
0285 case .Double(let d):
0286 guard let val = convertDoubleToInt64(d) else {
0287 throw JSONError.OutOfRangeDouble(path: nil, value: d, expected: Swift.Int64.self)
0288 }
0289 return val
0290 case .String(let s):
0291 if let i = Swift.Int64(s, radix: 10) {
0292 return i
0293 } else if let d = Swift.Double(s) {
0294 guard let val = convertDoubleToInt64(d) else {
0295 throw JSONError.OutOfRangeDouble(path: nil, value: d, expected: Swift.Int64.self)
0296 }
0297 return val
0298 }
0299 case .Null:
0300 return nil
0301 default:
0302 break
0303 }
0304 throw JSONError.MissingOrInvalidType(path: nil, expected: expected, actual: .forValue(self))
0305 }
0306
0307 Returns Throws func toInt| Accessors.swift:166 | return try? toInt() |
| JSONError.swift:621 | return try scoped(key) { try value.toInt() } |
| JSONError.swift:924 | return try scoped(index) { try value.toInt() } |
| JSONError.swift:1199 | return try scoped(key) { try value.toInt() } |
() throws -> Int {
0315 let val = try toInt64()
0316 let truncated = Int(truncatingBitPattern: val)
0317 guard Swift.Int64(truncated) == val else { throw JSONError.OutOfRangeInt64(path: nil, value: val, expected: Int.self) }
0318 return truncated
0319 }
0320
0321 Returns Throws func toIntOrNil| JSONError.swift:633 | return try scoped(key) { try value.toIntOrNil() } |
| JSONError.swift:937 | return try scoped(index) { try value.toIntOrNil() } |
| JSONError.swift:1210 | return try scoped(key) { try value.toIntOrNil() } |
() throws -> Int? {
0329 guard let val = try toInt64OrNil() else { return nil }
0330 let truncated = Int(truncatingBitPattern: val)
0331 guard Swift.Int64(truncated) == val else { throw JSONError.OutOfRangeInt64(path: nil, value: val, expected: Int.self) }
0332 return truncated
0333 }
0334
0335 Returns Throws func toDouble| Accessors.swift:173 | return try? toDouble() |
| JSONError.swift:645 | return try scoped(key) { try value.toDouble() } |
| JSONError.swift:950 | return try scoped(index) { try value.toDouble() } |
| JSONError.swift:1221 | return try scoped(key) { try value.toDouble() } |
() throws -> Swift.Double {
0340 guard let val = try toDoubleMaybeNil(.Required(.Number)) else {
0341 throw JSONError.MissingOrInvalidType(path: nil, expected: .Required(.Number), actual: .Null)
0342 }
0343 return val
0344 }
0345
0346 Returns Throws func toDoubleOrNil| JSONError.swift:656 | return try scoped(key) { try value.toDoubleOrNil() } |
| JSONError.swift:962 | return try scoped(index) { try value.toDoubleOrNil() } |
| JSONError.swift:1231 | return try scoped(key) { try value.toDoubleOrNil() } |
() throws -> Swift.Double? {
0351 return try toDoubleMaybeNil(.Optional(.Number))
0352 }
0353
0354 private func toDoubleMaybeNil| JSONError.swift:340 | guard let val = try toDoubleMaybeNil(.Required(.Number)) else { |
| JSONError.swift:351 | return try toDoubleMaybeNil(.Optional(.Number)) |
(expected: JSONError.ExpectedType) throws -> Swift.Double? {
0355 switch self {
0356 case .Int64(let i): return Swift.Double(i)
0357 case .Double(let d): return d
0358 case .String(let s): return Swift.Double(s)
0359 case .Null: return nil
0360 default: throw JSONError.MissingOrInvalidType(path: nil, expected: expected, actual: .forValue(self))
0361 }
0362 }
0363 }
0364
0365 public extension JSON {
0367 Parameter Returns Throws func getBool(key: Swift.String) throws -> Swift.Bool {
0373 let dict = try getObject()
0374 let value = try getRequired(dict, key: key, type: .String)
0375 return try scoped(key) { try value.getBool() }
0376 }
0377
0378 Parameter Returns Throws func getBoolOrNil(key: Swift.String) throws -> Swift.Bool? {
0383 let dict = try getObject()
0384 guard let value = dict[key] else { return nil }
0385 return try scoped(key) { try value.getBoolOrNil() }
0386 }
0387
0388 Parameter Returns Throws func getString(key: Swift.String) throws -> Swift.String {
0394 let dict = try getObject()
0395 let value = try getRequired(dict, key: key, type: .String)
0396 return try scoped(key) { try value.getString() }
0397 }
0398
0399 Parameter Returns Throws func getStringOrNil(key: Swift.String) throws -> Swift.String? {
0404 let dict = try getObject()
0405 guard let value = dict[key] else { return nil }
0406 return try scoped(key) { try value.getStringOrNil() }
0407 }
0408
0409 Parameter Returns Throws func getInt64(key: Swift.String) throws -> Swift.Int64 {
0415 let dict = try getObject()
0416 let value = try getRequired(dict, key: key, type: .Number)
0417 return try scoped(key) { try value.getInt64() }
0418 }
0419
0420 Parameter Returns Throws func getInt64OrNil(key: Swift.String) throws -> Swift.Int64? {
0425 let dict = try getObject()
0426 guard let value = dict[key] else { return nil }
0427 return try scoped(key) { try value.getInt64OrNil() }
0428 }
0429
0430 Parameter Returns Throws func getInt(key: Swift.String) throws -> Int {
0437 let dict = try getObject()
0438 let value = try getRequired(dict, key: key, type: .Number)
0439 return try scoped(key) { try value.getInt() }
0440 }
0441
0442 Parameter Returns Throws func getIntOrNil(key: Swift.String) throws -> Int? {
0448 let dict = try getObject()
0449 guard let value = dict[key] else { return nil }
0450 return try scoped(key) { try value.getIntOrNil() }
0451 }
0452
0453 Parameter Returns Throws func getDouble(key: Swift.String) throws -> Swift.Double {
0459 let dict = try getObject()
0460 let value = try getRequired(dict, key: key, type: .Number)
0461 return try scoped(key) { try value.getDouble() }
0462 }
0463
0464 Parameter Returns Throws func getDoubleOrNil(key: Swift.String) throws -> Swift.Double? {
0469 let dict = try getObject()
0470 guard let value = dict[key] else { return nil }
0471 return try scoped(key) { try value.getDoubleOrNil() }
0472 }
0473
0474 Note Parameter Returns Throws SeeAlso func getObject(key: Swift.String) throws -> JSONObject {
0483 return try getObject(key, { $0 })
0484 }
0485
0486 Note Parameter Returns Throws SeeAlso func getObjectOrNil(key: Swift.String) throws -> JSONObject? {
0494 return try getObjectOrNil(key, { $0 })
0495 }
0496
0497 Parameter Parameter Returns Throws func getObject| JSONError.swift:483 | return try getObject(key, { $0 }) |
<T>(key: Swift.String, @noescape _ transform: JSONObject throws -> T) throws -> T {
0504 return try getObject().getObject(key, transform)
0505 }
0506
0507 Parameter Parameter Returns Throws func getObjectOrNil| JSONError.swift:494 | return try getObjectOrNil(key, { $0 }) |
<T>(key: Swift.String, @noescape _ transform: JSONObject throws -> T?) throws -> T? {
0514 return try getObject().getObjectOrNil(key, transform)
0515 }
0516
0517 Note Parameter Throws SeeAlso func getArray(key: Swift.String) throws -> JSONArray {
0525 return try getArray(key, { $0 })
0526 }
0527
0528 Note Parameter Returns Throws SeeAlso func getArrayOrNil(key: Swift.String) throws -> JSONArray? {
0536 return try getArrayOrNil(key, { $0 })
0537 }
0538
0539 Parameter Parameter Returns Throws func getArray| JSONError.swift:525 | return try getArray(key, { $0 }) |
<T>(key: Swift.String, @noescape _ transform: JSONArray throws -> T) throws -> T {
0546 let dict = try getObject()
0547 let value = try getRequired(dict, key: key, type: .Array)
0548 return try scoped(key) { try transform(value.getArray()) }
0549 }
0550
0551 Parameter Parameter Returns Throws func getArrayOrNil| JSONError.swift:536 | return try getArrayOrNil(key, { $0 }) |
<T>(key: Swift.String, @noescape _ transform: JSONArray throws -> T?) throws -> T? {
0558 let dict = try getObject()
0559 guard let value = dict[key] else { return nil }
0560 return try scoped(key) { try value.getArrayOrNil().flatMap(transform) }
0561 }
0562 }
0563
0564 public extension JSON {
0565 Parameter Returns Throws SeeAlso func toString(key: Swift.String) throws -> Swift.String {
0572 let dict = try getObject()
0573 let value = try getRequired(dict, key: key, type: .String)
0574 return try scoped(key) { try value.toString() }
0575 }
0576
0577 Parameter Returns Throws SeeAlso func toStringOrNil(key: Swift.String) throws -> Swift.String? {
0583 let dict = try getObject()
0584 guard let value = dict[key] else { return nil }
0585 return try scoped(key) { try value.toStringOrNil() }
0586 }
0587
0588 Parameter Returns Throws func toInt64(key: Swift.String) throws -> Swift.Int64 {
0595 let dict = try getObject()
0596 let value = try getRequired(dict, key: key, type: .Number)
0597 return try scoped(key) { try value.toInt64() }
0598 }
0599
0600 Parameter Returns Throws func toInt64OrNil(key: Swift.String) throws -> Swift.Int64? {
0607 let dict = try getObject()
0608 guard let value = dict[key] else { return nil }
0609 return try scoped(key) { try value.toInt64OrNil() }
0610 }
0611
0612 Parameter Returns Throws func toInt(key: Swift.String) throws -> Int {
0619 let dict = try getObject()
0620 let value = try getRequired(dict, key: key, type: .Number)
0621 return try scoped(key) { try value.toInt() }
0622 }
0623
0624 Parameter Returns Throws func toIntOrNil(key: Swift.String) throws -> Int? {
0631 let dict = try getObject()
0632 guard let value = dict[key] else { return nil }
0633 return try scoped(key) { try value.toIntOrNil() }
0634 }
0635
0636 Parameter Returns Throws func toDouble(key: Swift.String) throws -> Swift.Double {
0643 let dict = try getObject()
0644 let value = try getRequired(dict, key: key, type: .Number)
0645 return try scoped(key) { try value.toDouble() }
0646 }
0647
0648 Parameter Returns Throws func toDoubleOrNil(key: Swift.String) throws -> Swift.Double? {
0654 let dict = try getObject()
0655 guard let value = dict[key] else { return nil }
0656 return try scoped(key) { try value.toDoubleOrNil() }
0657 }
0658 }
0659
0660 public extension JSON {
0662 Parameter Returns Throws func getBool(index: Int) throws -> Swift.Bool {
0668 let ary = try getArray()
0669 let value = try getRequired(ary, index: index, type: .Bool)
0670 return try scoped(index) { try value.getBool() }
0671 }
0672
0673 Parameter Returns Throws func getBoolOrNil(index: Int) throws -> Swift.Bool? {
0678 let ary = try getArray()
0679 guard let value = ary[safe: index] else { return nil }
0680 return try scoped(index) { try value.getBoolOrNil() }
0681 }
0682
0683 Parameter Returns Throws func getString(index: Int) throws -> Swift.String {
0689 let ary = try getArray()
0690 let value = try getRequired(ary, index: index, type: .String)
0691 return try scoped(index) { try value.getString() }
0692 }
0693
0694 Parameter Returns Throws func getStringOrNil(index: Int) throws -> Swift.String? {
0699 let ary = try getArray()
0700 guard let value = ary[safe: index] else { return nil }
0701 return try scoped(index) { try value.getStringOrNil() }
0702 }
0703
0704 Parameter Returns Throws func getInt64(index: Int) throws -> Swift.Int64 {
0710 let ary = try getArray()
0711 let value = try getRequired(ary, index: index, type: .Number)
0712 return try scoped(index) { try value.getInt64() }
0713 }
0714
0715 Parameter Returns Throws func getInt64OrNil(index: Int) throws -> Swift.Int64? {
0720 let ary = try getArray()
0721 guard let value = ary[safe: index] else { return nil }
0722 return try scoped(index) { try value.getInt64OrNil() }
0723 }
0724
0725 Parameter Returns Throws func getInt(index: Int) throws -> Int {
0732 let ary = try getArray()
0733 let value = try getRequired(ary, index: index, type: .Number)
0734 return try scoped(index) { try value.getInt() }
0735 }
0736
0737 Parameter Returns Throws func getIntOrNil(index: Int) throws -> Int? {
0743 let ary = try getArray()
0744 guard let value = ary[safe: index] else { return nil }
0745 return try scoped(index) { try value.getIntOrNil() }
0746 }
0747
0748 Parameter Returns Throws func getDouble(index: Int) throws -> Swift.Double {
0754 let ary = try getArray()
0755 let value = try getRequired(ary, index: index, type: .Number)
0756 return try scoped(index) { try value.getDouble() }
0757 }
0758
0759 Parameter Returns Throws func getDoubleOrNil(index: Int) throws -> Swift.Double? {
0764 let ary = try getArray()
0765 guard let value = ary[safe: index] else { return nil }
0766 return try scoped(index) { try value.getDoubleOrNil() }
0767 }
0768
0769 Note Parameter Returns Throws SeeAlso func getObject(index: Int) throws -> JSONObject {
0778 return try getObject(index, { $0 })
0779 }
0780
0781 Note Parameter Returns Throws SeeAlso func getObjectOrNil(index: Int) throws -> JSONObject? {
0789 return try getObjectOrNil(index, { $0 })
0790 }
0791
0792 Parameter Parameter Returns Throws func getObject| JSONError.swift:778 | return try getObject(index, { $0 }) |
<T>(index: Int, @noescape _ f: JSONObject throws -> T) throws -> T {
0799 let ary = try getArray()
0800 let value = try getRequired(ary, index: index, type: .Object)
0801 return try scoped(index) { try f(value.getObject()) }
0802 }
0803
0804 Parameter Parameter Returns Throws func getObjectOrNil| JSONError.swift:789 | return try getObjectOrNil(index, { $0 }) |
<T>(index: Int, @noescape _ f: JSONObject throws -> T?) throws -> T? {
0811 let ary = try getArray()
0812 guard let value = ary[safe: index] else { return nil }
0813 return try scoped(index) { try value.getObjectOrNil().flatMap(f) }
0814 }
0815
0816 Note Parameter Returns Throws SeeAlso func getArray(index: Int) throws -> JSONArray {
0825 return try getArray(index, { $0 })
0826 }
0827
0828 Note Parameter Returns Throws SeeAlso func getArrayOrNil(index: Int) throws -> JSONArray? {
0836 return try getArrayOrNil(index, { $0 })
0837 }
0838
0839 Parameter Parameter Returns Throws func getArray| JSONError.swift:825 | return try getArray(index, { $0 }) |
<T>(index: Int, @noescape _ f: JSONArray throws -> T) throws -> T {
0846 let ary = try getArray()
0847 let value = try getRequired(ary, index: index, type: .Array)
0848 return try scoped(index) { try f(value.getArray()) }
0849 }
0850
0851 Parameter Parameter Returns Throws func getArrayOrNil| JSONError.swift:836 | return try getArrayOrNil(index, { $0 }) |
<T>(index: Int, @noescape _ f: JSONArray throws -> T?) throws -> T? {
0858 let ary = try getArray()
0859 guard let value = ary[safe: index] else { return nil }
0860 return try scoped(index) { try value.getArrayOrNil().flatMap(f) }
0861 }
0862 }
0863
0864 public extension JSON {
0865 Parameter Returns Throws SeeAlso func toString(index: Int) throws -> Swift.String {
0872 let ary = try getArray()
0873 let value = try getRequired(ary, index: index, type: .String)
0874 return try scoped(index) { try value.toString() }
0875 }
0876
0877 Parameter Returns Throws SeeAlso func toStringOrNil(index: Int) throws -> Swift.String? {
0883 let ary = try getArray()
0884 guard let value = ary[safe: index] else { return nil }
0885 return try scoped(index) { try value.toStringOrNil() }
0886 }
0887
0888 Parameter Returns Throws SeeAlso func toInt64(index: Int) throws -> Swift.Int64 {
0896 let ary = try getArray()
0897 let value = try getRequired(ary, index: index, type: .Number)
0898 return try scoped(index) { try value.toInt64() }
0899 }
0900
0901 Parameter Returns Throws SeeAlso func toInt64OrNil(index: Int) throws -> Swift.Int64? {
0909 let ary = try getArray()
0910 guard let value = ary[safe: index] else { return nil }
0911 return try scoped(index) { try value.toInt64OrNil() }
0912 }
0913
0914 Parameter Returns Throws SeeAlso func toInt(index: Int) throws -> Int {
0922 let ary = try getArray()
0923 let value = try getRequired(ary, index: index, type: .Number)
0924 return try scoped(index) { try value.toInt() }
0925 }
0926
0927 Parameter Returns Throws SeeAlso func toIntOrNil(index: Int) throws -> Int? {
0935 let ary = try getArray()
0936 guard let value = ary[safe: index] else { return nil }
0937 return try scoped(index) { try value.toIntOrNil() }
0938 }
0939
0940 Parameter Returns Throws SeeAlso func toDouble(index: Int) throws -> Swift.Double {
0948 let ary = try getArray()
0949 let value = try getRequired(ary, index: index, type: .Number)
0950 return try scoped(index) { try value.toDouble() }
0951 }
0952
0953 Parameter Returns Throws SeeAlso func toDoubleOrNil(index: Int) throws -> Swift.Double? {
0960 let ary = try getArray()
0961 guard let value = ary[safe: index] else { return nil }
0962 return try scoped(index) { try value.toDoubleOrNil() }
0963 }
0964 }
0965
0966
0968 public extension JSONObject {
0969 Parameter Returns Throws func getBool(key: Swift.String) throws -> Swift.Bool {
0974 let value = try getRequired(self, key: key, type: .String)
0975 return try scoped(key) { try value.getBool() }
0976 }
0977
0978 Parameter Returns Throws func getBoolOrNil(key: Swift.String) throws -> Swift.Bool? {
0983 guard let value = self[key] else { return nil }
0984 return try scoped(key) { try value.getBoolOrNil() }
0985 }
0986
0987 Parameter Returns Throws func getString(key: Swift.String) throws -> Swift.String {
0992 let value = try getRequired(self, key: key, type: .String)
0993 return try scoped(key) { try value.getString() }
0994 }
0995
0996 Parameter Returns Throws func getStringOrNil(key: Swift.String) throws -> Swift.String? {
1001 guard let value = self[key] else { return nil }
1002 return try scoped(key) { try value.getStringOrNil() }
1003 }
1004
1005 Parameter Returns Throws func getInt64(key: Swift.String) throws -> Swift.Int64 {
1010 let value = try getRequired(self, key: key, type: .Number)
1011 return try scoped(key) { try value.getInt64() }
1012 }
1013
1014 Parameter Returns Throws func getInt64OrNil(key: Swift.String) throws -> Swift.Int64? {
1019 guard let value = self[key] else { return nil }
1020 return try scoped(key) { try value.getInt64OrNil() }
1021 }
1022
1023 Parameter Returns Throws func getInt(key: Swift.String) throws -> Int {
1029 let value = try getRequired(self, key: key, type: .Number)
1030 return try scoped(key) { try value.getInt() }
1031 }
1032
1033 Parameter Returns Throws func getIntOrNil(key: Swift.String) throws -> Int? {
1039 guard let value = self[key] else { return nil }
1040 return try scoped(key) { try value.getIntOrNil() }
1041 }
1042
1043 Parameter Returns Throws func getDouble(key: Swift.String) throws -> Swift.Double {
1048 let value = try getRequired(self, key: key, type: .Number)
1049 return try scoped(key) { try value.getDouble() }
1050 }
1051
1052 Parameter Returns Throws func getDoubleOrNil(key: Swift.String) throws -> Swift.Double? {
1057 guard let value = self[key] else { return nil }
1058 return try scoped(key) { try value.getDoubleOrNil() }
1059 }
1060
1061 Note Parameter Returns Throws SeeAlso func getObject(key: Swift.String) throws -> JSONObject {
1069 return try getObject(key, { $0 })
1070 }
1071
1072 Note Parameter Returns Throws SeeAlso func getObjectOrNil(key: Swift.String) throws -> JSONObject? {
1080 return try getObjectOrNil(key, { $0 })
1081 }
1082
1083 Parameter Parameter Returns Throws func getObject| JSONError.swift:504 | return try getObject().getObject(key, transform) |
| JSONError.swift:1069 | return try getObject(key, { $0 }) |
<T>(key: Swift.String, @noescape _ f: JSONObject throws -> T) throws -> T {
1090 let value = try getRequired(self, key: key, type: .Object)
1091 return try scoped(key) { try f(value.getObject()) }
1092 }
1093
1094 Parameter Parameter Returns Throws func getObjectOrNil| JSONError.swift:514 | return try getObject().getObjectOrNil(key, transform) |
| JSONError.swift:1080 | return try getObjectOrNil(key, { $0 }) |
<T>(key: Swift.String, @noescape _ f: JSONObject throws -> T?) throws -> T? {
1100 guard let value = self[key] else { return nil }
1101 return try scoped(key) { try value.getObjectOrNil().flatMap(f) }
1102 }
1103
1104 Note Parameter Throws SeeAlso func getArray(key: Swift.String) throws -> JSONArray {
1111 return try getArray(key, { $0 })
1112 }
1113
1114 Note Parameter Returns Throws SeeAlso func getArrayOrNil(key: Swift.String) throws -> JSONArray? {
1122 return try getArrayOrNil(key, { $0 })
1123 }
1124
1125 Parameter Parameter Returns Throws func getArray| JSONError.swift:1111 | return try getArray(key, { $0 }) |
<T>(key: Swift.String, @noescape _ f: JSONArray throws -> T) throws -> T {
1132 let value = try getRequired(self, key: key, type: .Array)
1133 return try scoped(key) { try f(value.getArray()) }
1134 }
1135
1136 Parameter Parameter Returns Throws func getArrayOrNil| JSONError.swift:1122 | return try getArrayOrNil(key, { $0 }) |
<T>(key: Swift.String, @noescape _ f: JSONArray throws -> T?) throws -> T? {
1142 guard let value = self[key] else { return nil }
1143 return try scoped(key) { try value.getArrayOrNil().flatMap(f) }
1144 }
1145 }
1146
1147 public extension JSONObject {
1148 Parameter Returns Throws SeeAlso func toString(key: Swift.String) throws -> Swift.String {
1155 let value = try getRequired(self, key: key, type: .String)
1156 return try scoped(key) { try value.toString() }
1157 }
1158
1159 Parameter Returns Throws SeeAlso func toStringOrNil(key: Swift.String) throws -> Swift.String? {
1165 guard let value = self[key] else { return nil }
1166 return try scoped(key) { try value.toStringOrNil() }
1167 }
1168
1169 Parameter Returns Throws func toInt64(key: Swift.String) throws -> Swift.Int64 {
1176 let value = try getRequired(self, key: key, type: .Number)
1177 return try scoped(key) { try value.toInt64() }
1178 }
1179
1180 Parameter Returns Throws func toInt64OrNil(key: Swift.String) throws -> Swift.Int64? {
1187 guard let value = self[key] else { return nil }
1188 return try scoped(key) { try value.toInt64OrNil() }
1189 }
1190
1191 Parameter Returns Throws func toInt(key: Swift.String) throws -> Int {
1198 let value = try getRequired(self, key: key, type: .Number)
1199 return try scoped(key) { try value.toInt() }
1200 }
1201
1202 Parameter Returns Throws func toIntOrNil(key: Swift.String) throws -> Int? {
1209 guard let value = self[key] else { return nil }
1210 return try scoped(key) { try value.toIntOrNil() }
1211 }
1212
1213 Parameter Returns Throws func toDouble(key: Swift.String) throws -> Swift.Double {
1220 let value = try getRequired(self, key: key, type: .Number)
1221 return try scoped(key) { try value.toDouble() }
1222 }
1223
1224 Parameter Returns Throws func toDoubleOrNil(key: Swift.String) throws -> Swift.Double? {
1230 guard let value = self[key] else { return nil }
1231 return try scoped(key) { try value.toDoubleOrNil() }
1232 }
1233 }
1234
1235
1237 public extension JSON {
1238 Parameter Parameter Returns Throws Complexity Bug static func map<T>(array: JSONArray, @noescape _ transform: JSON throws -> T) throws -> [T] {
1250 return try array.enumerate().map({ i, elt in try scoped(i, f: { try transform(elt) }) })
1251 }
1252
1253 Parameter Parameter Returns Throws Complexity Bug static func flatMap<T>(array: JSONArray, @noescape _ transform: JSON throws -> T?) throws -> [T] {
1265 return try array.enumerate().flatMap({ i, elt in try scoped(i, f: { try transform(elt) }) })
1266 }
1267
1268 Parameter Parameter Returns Throws Complexity Bug static func flatMap<S: SequenceType>(array: JSONArray, _ transform: JSON throws -> S) throws -> [S.Generator.Element] {
1280 var results: [S.Generator.Element] = []
1282 for (i, elt) in array.enumerate() {
1283 try scoped(i) {
1284 results.appendContentsOf(try transform(elt))
1285 }
1286 }
1287 return results
1288 }
1289 }
1290
1291
1293 internal func getRequired| DecimalNumber.swift:104 | let value = try getRequired(dict, key: key, type: .Number) |
| DecimalNumber.swift:127 | let value = try getRequired(dict, key: key, type: .Number) |
| DecimalNumber.swift:200 | let value = try getRequired(self, key: key, type: .Number) |
| DecimalNumber.swift:221 | let value = try getRequired(self, key: key, type: .Number) |
| JSONError.swift:374 | let value = try getRequired(dict, key: key, type: .String) |
| JSONError.swift:395 | let value = try getRequired(dict, key: key, type: .String) |
| JSONError.swift:416 | let value = try getRequired(dict, key: key, type: .Number) |
| JSONError.swift:438 | let value = try getRequired(dict, key: key, type: .Number) |
| JSONError.swift:460 | let value = try getRequired(dict, key: key, type: .Number) |
| JSONError.swift:547 | let value = try getRequired(dict, key: key, type: .Array) |
| JSONError.swift:573 | let value = try getRequired(dict, key: key, type: .String) |
| JSONError.swift:596 | let value = try getRequired(dict, key: key, type: .Number) |
| JSONError.swift:620 | let value = try getRequired(dict, key: key, type: .Number) |
| JSONError.swift:644 | let value = try getRequired(dict, key: key, type: .Number) |
| JSONError.swift:974 | let value = try getRequired(self, key: key, type: .String) |
| JSONError.swift:992 | let value = try getRequired(self, key: key, type: .String) |
| JSONError.swift:1010 | let value = try getRequired(self, key: key, type: .Number) |
| JSONError.swift:1029 | let value = try getRequired(self, key: key, type: .Number) |
| JSONError.swift:1048 | let value = try getRequired(self, key: key, type: .Number) |
| JSONError.swift:1090 | let value = try getRequired(self, key: key, type: .Object) |
| JSONError.swift:1132 | let value = try getRequired(self, key: key, type: .Array) |
| JSONError.swift:1155 | let value = try getRequired(self, key: key, type: .String) |
| JSONError.swift:1176 | let value = try getRequired(self, key: key, type: .Number) |
| JSONError.swift:1198 | let value = try getRequired(self, key: key, type: .Number) |
| JSONError.swift:1220 | let value = try getRequired(self, key: key, type: .Number) |
(dict: JSONObject, key: String, type: JSONError.JSONType) throws -> JSON {
1294 guard let value = dict[key] else { throw JSONError.MissingOrInvalidType(path: key, expected: .Required(type), actual: nil) }
1295 return value
1296 }
1297
1298 internal func getRequired| DecimalNumber.swift:153 | let value = try getRequired(array, index: index, type: .Number) |
| DecimalNumber.swift:175 | let value = try getRequired(array, index: index, type: .Number) |
| JSONError.swift:669 | let value = try getRequired(ary, index: index, type: .Bool) |
| JSONError.swift:690 | let value = try getRequired(ary, index: index, type: .String) |
| JSONError.swift:711 | let value = try getRequired(ary, index: index, type: .Number) |
| JSONError.swift:733 | let value = try getRequired(ary, index: index, type: .Number) |
| JSONError.swift:755 | let value = try getRequired(ary, index: index, type: .Number) |
| JSONError.swift:800 | let value = try getRequired(ary, index: index, type: .Object) |
| JSONError.swift:847 | let value = try getRequired(ary, index: index, type: .Array) |
| JSONError.swift:873 | let value = try getRequired(ary, index: index, type: .String) |
| JSONError.swift:897 | let value = try getRequired(ary, index: index, type: .Number) |
| JSONError.swift:923 | let value = try getRequired(ary, index: index, type: .Number) |
| JSONError.swift:949 | let value = try getRequired(ary, index: index, type: .Number) |
(ary: JSONArray, index: Int, type: JSONError.JSONType) throws -> JSON {
1299 guard let value = ary[safe: index] else { throw JSONError.MissingOrInvalidType(path: "[\(index)]", expected: .Required(type), actual: nil) }
1300 return value
1301 }
1302
1303 @inline(__always)
1304 internal func scoped| DecimalNumber.swift:105 | return try scoped(key) { try value.getDecimalNumber() } |
| DecimalNumber.swift:116 | return try scoped(key) { try value.getDecimalNumberOrNil() } |
| DecimalNumber.swift:128 | return try scoped(key) { try value.toDecimalNumber() } |
| DecimalNumber.swift:139 | return try scoped(key) { try value.toDecimalNumberOrNil() } |
| DecimalNumber.swift:201 | return try scoped(key) { try value.getDecimalNumber() } |
| DecimalNumber.swift:211 | return try scoped(key) { try value.getDecimalNumberOrNil() } |
| DecimalNumber.swift:222 | return try scoped(key) { try value.toDecimalNumber() } |
| DecimalNumber.swift:232 | return try scoped(key) { try value.toDecimalNumberOrNil() } |
| JSONError.swift:375 | return try scoped(key) { try value.getBool() } |
| JSONError.swift:385 | return try scoped(key) { try value.getBoolOrNil() } |
| JSONError.swift:396 | return try scoped(key) { try value.getString() } |
| JSONError.swift:406 | return try scoped(key) { try value.getStringOrNil() } |
| JSONError.swift:417 | return try scoped(key) { try value.getInt64() } |
| JSONError.swift:427 | return try scoped(key) { try value.getInt64OrNil() } |
| JSONError.swift:439 | return try scoped(key) { try value.getInt() } |
| JSONError.swift:450 | return try scoped(key) { try value.getIntOrNil() } |
| JSONError.swift:461 | return try scoped(key) { try value.getDouble() } |
| JSONError.swift:471 | return try scoped(key) { try value.getDoubleOrNil() } |
| JSONError.swift:548 | return try scoped(key) { try transform(value.getArray()) } |
| JSONError.swift:560 | return try scoped(key) { try value.getArrayOrNil().flatMap(transform) } |
| JSONError.swift:574 | return try scoped(key) { try value.toString() } |
| JSONError.swift:585 | return try scoped(key) { try value.toStringOrNil() } |
| JSONError.swift:597 | return try scoped(key) { try value.toInt64() } |
| JSONError.swift:609 | return try scoped(key) { try value.toInt64OrNil() } |
| JSONError.swift:621 | return try scoped(key) { try value.toInt() } |
| JSONError.swift:633 | return try scoped(key) { try value.toIntOrNil() } |
| JSONError.swift:645 | return try scoped(key) { try value.toDouble() } |
| JSONError.swift:656 | return try scoped(key) { try value.toDoubleOrNil() } |
| JSONError.swift:975 | return try scoped(key) { try value.getBool() } |
| JSONError.swift:984 | return try scoped(key) { try value.getBoolOrNil() } |
| JSONError.swift:993 | return try scoped(key) { try value.getString() } |
| JSONError.swift:1002 | return try scoped(key) { try value.getStringOrNil() } |
| JSONError.swift:1011 | return try scoped(key) { try value.getInt64() } |
| JSONError.swift:1020 | return try scoped(key) { try value.getInt64OrNil() } |
| JSONError.swift:1030 | return try scoped(key) { try value.getInt() } |
| JSONError.swift:1040 | return try scoped(key) { try value.getIntOrNil() } |
| JSONError.swift:1049 | return try scoped(key) { try value.getDouble() } |
| JSONError.swift:1058 | return try scoped(key) { try value.getDoubleOrNil() } |
| JSONError.swift:1091 | return try scoped(key) { try f(value.getObject()) } |
| JSONError.swift:1101 | return try scoped(key) { try value.getObjectOrNil().flatMap(f) } |
| JSONError.swift:1133 | return try scoped(key) { try f(value.getArray()) } |
| JSONError.swift:1143 | return try scoped(key) { try value.getArrayOrNil().flatMap(f) } |
| JSONError.swift:1156 | return try scoped(key) { try value.toString() } |
| JSONError.swift:1166 | return try scoped(key) { try value.toStringOrNil() } |
| JSONError.swift:1177 | return try scoped(key) { try value.toInt64() } |
| JSONError.swift:1188 | return try scoped(key) { try value.toInt64OrNil() } |
| JSONError.swift:1199 | return try scoped(key) { try value.toInt() } |
| JSONError.swift:1210 | return try scoped(key) { try value.toIntOrNil() } |
| JSONError.swift:1221 | return try scoped(key) { try value.toDouble() } |
| JSONError.swift:1231 | return try scoped(key) { try value.toDoubleOrNil() } |
<T>(key: String, @noescape f: () throws -> T) throws -> T {
1305 do {
1306 return try f()
1307 } catch let error as JSONError {
1308 throw error.withPrefix(key)
1309 }
1310 }
1311
1312 @inline(__always)
1313 internal func scoped| DecimalNumber.swift:154 | return try scoped(index) { try value.getDecimalNumber() } |
| DecimalNumber.swift:164 | return try scoped(index) { try value.getDecimalNumberOrNil() } |
| DecimalNumber.swift:176 | return try scoped(index) { try value.toDecimalNumber() } |
| DecimalNumber.swift:187 | return try scoped(index) { try value.toDecimalNumberOrNil() } |
| JSONError.swift:670 | return try scoped(index) { try value.getBool() } |
| JSONError.swift:680 | return try scoped(index) { try value.getBoolOrNil() } |
| JSONError.swift:691 | return try scoped(index) { try value.getString() } |
| JSONError.swift:701 | return try scoped(index) { try value.getStringOrNil() } |
| JSONError.swift:712 | return try scoped(index) { try value.getInt64() } |
| JSONError.swift:722 | return try scoped(index) { try value.getInt64OrNil() } |
| JSONError.swift:734 | return try scoped(index) { try value.getInt() } |
| JSONError.swift:745 | return try scoped(index) { try value.getIntOrNil() } |
| JSONError.swift:756 | return try scoped(index) { try value.getDouble() } |
| JSONError.swift:766 | return try scoped(index) { try value.getDoubleOrNil() } |
| JSONError.swift:801 | return try scoped(index) { try f(value.getObject()) } |
| JSONError.swift:813 | return try scoped(index) { try value.getObjectOrNil().flatMap(f) } |
| JSONError.swift:848 | return try scoped(index) { try f(value.getArray()) } |
| JSONError.swift:860 | return try scoped(index) { try value.getArrayOrNil().flatMap(f) } |
| JSONError.swift:874 | return try scoped(index) { try value.toString() } |
| JSONError.swift:885 | return try scoped(index) { try value.toStringOrNil() } |
| JSONError.swift:898 | return try scoped(index) { try value.toInt64() } |
| JSONError.swift:911 | return try scoped(index) { try value.toInt64OrNil() } |
| JSONError.swift:924 | return try scoped(index) { try value.toInt() } |
| JSONError.swift:937 | return try scoped(index) { try value.toIntOrNil() } |
| JSONError.swift:950 | return try scoped(index) { try value.toDouble() } |
| JSONError.swift:962 | return try scoped(index) { try value.toDoubleOrNil() } |
| JSONError.swift:1250 | return try array.enumerate().map({ i, elt in try scoped(i, f: { try transform(elt) }) }) |
| JSONError.swift:1265 | return try array.enumerate().flatMap({ i, elt in try scoped(i, f: { try transform(elt) }) }) |
| JSONError.swift:1283 | try scoped(i) { |
<T>(index: Int, @noescape f: () throws -> T) throws -> T {
1314 do {
1315 return try f()
1316 } catch let error as JSONError {
1317 throw error.withPrefix("[\(index)]")
1318 }
1319 }
1320
1321 internal extension ContiguousArray {
1322 subscript| DecimalNumber.swift:163 | guard let value = array[safe: index] else { return nil } |
| DecimalNumber.swift:186 | guard let value = array[safe: index] else { return nil } |
| JSONError.swift:679 | guard let value = ary[safe: index] else { return nil } |
| JSONError.swift:700 | guard let value = ary[safe: index] else { return nil } |
| JSONError.swift:721 | guard let value = ary[safe: index] else { return nil } |
| JSONError.swift:744 | guard let value = ary[safe: index] else { return nil } |
| JSONError.swift:765 | guard let value = ary[safe: index] else { return nil } |
| JSONError.swift:812 | guard let value = ary[safe: index] else { return nil } |
| JSONError.swift:859 | guard let value = ary[safe: index] else { return nil } |
| JSONError.swift:884 | guard let value = ary[safe: index] else { return nil } |
| JSONError.swift:910 | guard let value = ary[safe: index] else { return nil } |
| JSONError.swift:936 | guard let value = ary[safe: index] else { return nil } |
| JSONError.swift:961 | guard let value = ary[safe: index] else { return nil } |
| JSONError.swift:1299 | guard let value = ary[safe: index] else { throw JSONError.MissingOrInvalidType(path: "[\(index)]", expected: .Required(type), actual: nil) } |
(safe index: Int) -> Element? {
1323 guard index >= startIndex && index < endIndex else { return nil }
1324 return self[index]
1325 }
1326 }
1327