How to you propose to change the __id__ value ?
cadesalaberry opened this issue · 3 comments
cadesalaberry commented
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 commented
I prefer the "ugly" one, to be honest.
cadesalaberry commented
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 commented
I didn't notice that! @carlos8f would you like to make a pull request?