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

How to you propose to change the __id__ value ? #4

Open
cadesalaberry opened this issue Oct 4, 2016 · 3 comments
Open

How to you propose to change the __id__ value ? #4

cadesalaberry opened this issue Oct 4, 2016 · 3 comments

Comments

@cadesalaberry
Copy link

In my use of xdiff, I need to deduce uniqueness from the "id" field, not __id__. I have seen it was one of your next amelioration.

How do you propose to go about it ?

I was thinking about:

var x = require('xdiff').withIdField('id')
var x = require('xdiff')
x.setIdField('id')

A bit uglier, add an idField parameter to all the functions defaulting to __id__ if not specified:

function shallowEqual (a, b, idField) {
...
@dominictarr
Copy link
Owner

I prefer the "ugly" one, to be honest.

@cadesalaberry
Copy link
Author

I looked around a bit, and it seemed that https://www.npmjs.com/package/diff-json had a pretty nice way to do it with a primary key object.

Other than that, I realised one of your fork actually had the id implementation: https://github.com/carlos8f/xdiff

I think that's what I will try to use for now.

Cheers

@dominictarr
Copy link
Owner

I didn't notice that! @carlos8f would you like to make a pull request?

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

No branches or pull requests

2 participants