Open
Description
Hi Matt. Great package thanks.
Would you be able to create versions of deletedDiff, updatedDiff, detailedDiff
or have them accept an optional shouldShowOriginal
argument to also return the original values too? Eg:
const lhs = {
foo: {
bar: {
a: ['a', 'b'],
b: 2,
c: ['x', 'y'],
e: 100 // deleted
}
},
buzz: 'world'
};
const rhs = {
foo: {
bar: {
a: ['a'], // index 1 ('b') deleted
b: 2, // unchanged
c: ['x', 'y', 'z'], // 'z' added
d: 'Hello, world!' // added
}
},
buzz: 'fizz' // updated
};
console.log(detailedDiff(lhs, rhs, true));
/*
{
added: {
foo: {
bar: {
c: {
'2': 'z'
},
d: 'Hello, world!'
}
}
},
deleted: {
foo: {
bar: {
a: {
'1': undefined
},
e: undefined
}
}
},
deletedOriginal: {
foo: {
bar: {
a: ['a', 'b'],
e: 100
}
}
},
updated: {
buzz: 'fizz'
}
updatedOriginal: {
buzz: 'world'
}
}
*/
Obviously just showing detailedDiff
implementation but would be same for deletedDiff, updatedDiff
.
Thanks.
Sean
Metadata
Metadata
Assignees
Labels
No labels