Skip to content
This repository was archived by the owner on Mar 6, 2018. It is now read-only.
This repository was archived by the owner on Mar 6, 2018. It is now read-only.

Support packing/unpacking during diff/apply #3

Open

Description

@Akkuma

This library is probably one of the only json patch implementations that has a serializer that can pack/unpack operations to reduce the size/verbosity of the implementation. My recommendation is to allow a user to do that at the same time, so there is no performance penalty during the initial diff or apply.

patch.diff(obj1, obj2, true) for packing while diffing.

Activity

  1. sonnyp commented on Oct 22, 2015

    @sonnyp
    Contributor

    I don't think the performance penalty is worth the effort as it is probably very minimal. If you can provide a use case where it makes sense I'll consider it. (PR would be accepted)

  2. Akkuma commented on Oct 22, 2015

    @Akkuma
    Author

    I'm suggesting that you replace the patches created through diff to use your serialized format if pack: true is passed to diff.

    I'm not asking for what amounts to pack(diff()). I'm asking for https://github.com/JSON8/patch/blob/master/lib/diff.js#L18 to use [0, "/a/b/c", ["foo", "bar"]] when pack: true. There should not be any overhead in this and would remove overhead a separate pack function is creating.

    The use case is fairly simple. JSON Patch is fairly verbose compared to the packed format and certainly is more verbose, although arguably more flexible, than JSON Merge Patch. By baking in the packing all at once, you get something that is better than standard JSON Patch and closer to size of JSON Merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions