-
Notifications
You must be signed in to change notification settings - Fork 6
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
return array of objects instead array of string #9
Comments
Thank you, glad you find it useful! Have you taken a look at just using the raw deep diff library?? This library is just a wrapper around that with a couple of edits that make it a little nicer. If you prefer my library since my syntax is a little simpler, I will add this as an option. Let me know! Also happy to accept PRs if you beat me to it. |
Actually, just looked and this is exposed already, but the api is a little weird, here is how you would get this: const HumanDiff = require('human-object-diff');
const differ = new HumanDiff({...options});
console.log(differ.diff({foo: 'bar'}, {foo: 'baz'})) // -> '"Foo", with a value of "bar" (at Obj.foo) was changed to "baz"'
console.log(differ.sentenceDiffs) // ->
// sentenceDiffs: [
// DiffSentence {
// diff: [Diff],
// FIELD: 'Foo',
// OLDVALUE: 'bar',
// NEWVALUE: 'baz',
// DOTPATH: 'Obj.foo',
// INDEX: undefined,
// POSITION: undefined,
// template: '"FIELD", with a value of "OLDVALUE" (at DOTPATH) was changed to "NEWVALUE"',
// format: [Function: bound format]
// }
// ]
Hopefully this will suit your needs! |
I am going to add this as an option to return the objects from |
there are three types that we have for differences:
when
and diff is
are we going to return these diffs as them are saved now, or introduce unification? |
Hi! :)
At start I want to say that I love your library! Is really helpfull to generate change history log...
in my project we want use translated history logs... and will be a lot easier if diff instead returning array of strings will return array with changes objects e.g.
what do you think about that?
Greetings from Poland :)
Daniel
The text was updated successfully, but these errors were encountered: