Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A question about applying a diff. #17

Closed
matouka opened this issue May 29, 2014 · 1 comment
Closed

A question about applying a diff. #17

matouka opened this issue May 29, 2014 · 1 comment
Labels

Comments

@matouka
Copy link

matouka commented May 29, 2014

Hi,

This is probably pretty simple, it just doesn't seem to be working as I expect. I have a Node app and am comparing an old record to a new one and calculating a diff. I am then sending that diff to the browser where an old version of the record resides. I am then attempting to apply the diff and having no luck.

So I tried to do it all in the browser and ran the following:
var arr1 = [1,2,3,4];
var arr2 = [1,2,3,4,5,6,7];
var diffs = DeepDiff(arr1, arr2);
DeepDiff(arr1, diffs);

Expecting to output the same as arr2? Instead I get an error.

Any suggestions.

Best regards,
Paul

@paulpflug
Copy link
Contributor

Hi,

your scenario is currently not supported.
there is a requirement for the diff to be an instance of the class Diff.
I think there is currently no way to create a proper Diff object of an arbitrary object.
So you can only use the Diff object on server side or client side, but not both, as the type gets lost on transmission.

I made a PR on this already #13. but I some sort of screwed up. Here is the commit which fixes this for you: ec7e878

@flitbit flitbit added the bug label Aug 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants
@paulpflug @matouka and others