Skip to content
This repository has been archived by the owner on Jun 28, 2019. It is now read-only.

How to return just the changed properties #3

Open
edbentinck opened this issue Jul 19, 2016 · 3 comments
Open

How to return just the changed properties #3

edbentinck opened this issue Jul 19, 2016 · 3 comments

Comments

@edbentinck
Copy link

Hi, is there a method which just returns only the changed properties? This would be essentially the result of toJsonDiffView, but without the comparisons. As an example, in the case of your demo this would result in:

Changed properties:

{
    a: {
        b: 2,
        c: {
            2: 3
        }
    },
    x: 1
}
@deepu105
Copy link
Member

Unfortunately no at the moment. You are welcome to do a PR if you would like

Thanks & Regards,
Deepu

On Wed, Jul 20, 2016 at 4:46 AM, edbentinck [email protected]
wrote:

Hi, is there a method which just returns only the changed properties? This
would be essentially the result of toJsonDiffView, but without the
comparisons. As an example, in the case of your demo this would result in:

Changed properties:

{
a: {
b: 2,
c: {
2: 3
}
},
x: 1
}


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#3, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABDlF1K9UuF6SUMLdR4KZx1eYBYQUkXlks5qXVrigaJpZM4JQRq6
.

@edbentinck
Copy link
Author

Ok. I can do that. That said, I feel that the current method names will be a little confusing if I add this functionality.

I understand that you based this package on another implementation and therefore you have essentially just followed their naming conventions, which makes sense. However, other diff packages use different terminology – for instance this very popular diff package – and personally I find them to be a bit more straight-forward.

In the example above they describe the term "diff" as being the result of the difference between the two objects, not the comparison itself.

So, if I were to add the proposed functionality I would probably favour amending the current method names to something along these lines:

toJsonView     -> fullDiffComparisonAsJson
toJsonDiffView -> diffComparisonAsJson

I would name the new function something like the following. This function would return an object rather than the JSON.

diffResult

Since you're the owner of this package I think it should be your call on the terminology used, but those are some of my thoughts before I start moving things around in your project 😛 Let me know what you think and I'll submit the PR. Any other suggestions for terminology are appreciated.

@deepu105
Copy link
Member

You can propose to change the method names, i can make a major release if
required

Thanks & regards,
Deepu
On 20 Jul 2016 13:42, "edbentinck" [email protected] wrote:

Ok. I can do that. That said, I feel that the current method names will be
a little confusing if I add this functionality.

I understand that you based this package on another implementation and
therefore you have essentially just followed their naming conventions,
which makes sense. However, other diff packages use different terminology –
for instance this very popular diff package
https://github.com/flitbit/diff – and personally I find them to be a
bit more straight-forward.

In the example above they describe the term "diff" as being the result of
the difference between the two objects, not the comparison itself.

So, if I were to add the proposed functionality I would probably favour
amending the current method names to something along these lines:

toJsonView -> fullDiffComparisonAsJson
toJsonDiffView -> diffComparisonAsJson

I would name the new function something like the following. This function
would return an object rather than the JSON.

diffResult

Since you're the owner of this package I think it should be your call on
the terminology used, but those are some of my thoughts before I start
moving things around in your project 😛 Let me know what you think and
I'll submit the PR. Any other suggestions for terminology are appreciated.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#3 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABDlF-ZHlbyvc57zR6_m63QeTYpjbYfBks5qXdhRgaJpZM4JQRq6
.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants