public static IJsonPatch InvertPatch(this IReversibleJsonPatch patch)
        {
            return(new JsonPatch
            {
                Operation = patch.Operation == JsonPatchOperation.Add ? JsonPatchOperation.Remove : patch.Operation == JsonPatchOperation.Remove ? JsonPatchOperation.Add : patch.Operation,

                Value = patch.OldValue,

                Path = patch.Path
            });
        }
        public static IJsonPatch StripPatch(this IReversibleJsonPatch patch)
        {
            // strips `oldvalue` information from the patch, so that it becomes a patch conform the json-patch spec
            // this removes the ability to undo the patch

            return(new JsonPatch
            {
                Operation = patch.Operation,

                Value = patch.Value,

                Path = patch.Path
            });
        }
 public static (IJsonPatch, IJsonPatch) SplitPatch(this IReversibleJsonPatch patch)
 {
     return(patch.StripPatch(), patch.InvertPatch());
 }