@@ -144,52 +144,52 @@ extension JSONValue {
144
144
}
145
145
146
146
/// Value Getters
147
- extension JSONValue {
147
+ public extension JSONValue {
148
148
/// If this `JSONValue` is a `.number` that can be losslessly represented as a `Double`, return it as a `Double`.
149
149
/// Otherwise, return nil.
150
- public var doubleValue : Double ? {
151
- guard case let . number( n) = self else {
150
+ var doubleValue : Double ? {
151
+ guard case . number( let n) = self else {
152
152
return nil
153
153
}
154
154
return Double ( n)
155
155
}
156
156
157
157
/// If this `JSONValue` is a `.number` that can be losslessly represented as an `Int`, return it as a `Int`.
158
158
/// Otherwise, return nil.
159
- public var intValue : Int ? {
160
- guard case let . number( n) = self else {
159
+ var intValue : Int ? {
160
+ guard case . number( let n) = self else {
161
161
return nil
162
162
}
163
163
return Int ( n)
164
164
}
165
165
166
166
/// If this `JSONValue` is a `.string`, return it as a `String`. Otherwise, return nil.
167
- public var stringValue : String ? {
168
- guard case let . string( s) = self else {
167
+ var stringValue : String ? {
168
+ guard case . string( let s) = self else {
169
169
return nil
170
170
}
171
171
return s
172
172
}
173
173
174
174
/// If this `JSONValue` is a `.bool`, return it as a `Bool`. Otherwise, return nil.
175
- public var boolValue : Bool ? {
176
- guard case let . bool( b) = self else {
175
+ var boolValue : Bool ? {
176
+ guard case . bool( let b) = self else {
177
177
return nil
178
178
}
179
179
return b
180
180
}
181
181
182
182
/// If this `JSONValue` is a `.array`, return it as a `[JSONValue]`. Otherwise, return nil.
183
- public var arrayValue : [ JSONValue ] ? {
184
- guard case let . array( a) = self else {
183
+ var arrayValue : [ JSONValue ] ? {
184
+ guard case . array( let a) = self else {
185
185
return nil
186
186
}
187
187
return a
188
188
}
189
189
190
190
/// If this `JSONValue` is a `.object`, return it as a `[String: JSONValue]`. Otherwise, return nil.
191
- public var objectValue : [ String : JSONValue ] ? {
192
- guard case let . object( o) = self else {
191
+ var objectValue : [ String : JSONValue ] ? {
192
+ guard case . object( let o) = self else {
193
193
return nil
194
194
}
195
195
return o
@@ -311,7 +311,7 @@ extension JSONValue: Codable {
311
311
public func encode( to encoder: Encoder ) throws {
312
312
var container = encoder. singleValueContainer ( )
313
313
switch self {
314
- case let . number( n) :
314
+ case . number( let n) :
315
315
if let int = self . intValue {
316
316
try container. encode ( int)
317
317
} else if let double = self . doubleValue {
@@ -325,13 +325,13 @@ extension JSONValue: Codable {
325
325
)
326
326
)
327
327
}
328
- case let . string( s) :
328
+ case . string( let s) :
329
329
try container. encode ( s)
330
- case let . bool( b) :
330
+ case . bool( let b) :
331
331
try container. encode ( b)
332
- case let . array( a) :
332
+ case . array( let a) :
333
333
try container. encode ( a)
334
- case let . object( o) :
334
+ case . object( let o) :
335
335
try container. encode ( o)
336
336
case . null:
337
337
try container. encodeNil ( )
0 commit comments