diff --git a/prototype/Doubt/Patch.swift b/prototype/Doubt/Patch.swift index 0c242e2ec..bece84799 100644 --- a/prototype/Doubt/Patch.swift +++ b/prototype/Doubt/Patch.swift @@ -140,3 +140,13 @@ extension Patch: PatchType { self = .Insert(after) } } + + +extension PatchType where Element: CofreeType, Element.Annotation == Range { + public func JSON(a a: String, b: String) -> Doubt.JSON { + return [ + "before": state.before.map { $0.JSON(a) } ?? nil, + "after": state.after.map { $0.JSON(b) } ?? nil, + ] + } +}