mirror of
https://github.com/github/semantic.git
synced 2024-12-24 23:42:31 +03:00
Add a JSONConverter property to JSONConvertibles.
This commit is contained in:
parent
b5efc49129
commit
806ea1ea93
@ -64,6 +64,12 @@ extension JSON: JSONConvertible {
|
||||
}
|
||||
}
|
||||
|
||||
extension JSONConvertible {
|
||||
static var JSONConverter: Prism<Self, Doubt.JSON> {
|
||||
return Prism(forward: { $0.JSON }, backward: { Self(JSON: $0) })
|
||||
}
|
||||
}
|
||||
|
||||
extension Prism where To : JSONConvertible {
|
||||
public var number: Prism<From, Double> {
|
||||
return self >>> Prism<To, Double>(forward: { $0.JSON.number }, backward: { To(JSON: .Number($0)) })
|
||||
|
Loading…
Reference in New Issue
Block a user