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

Add an option to keep unmodified values #85

Closed
syskin opened this issue May 4, 2022 · 2 comments
Closed

Add an option to keep unmodified values #85

syskin opened this issue May 4, 2022 · 2 comments

Comments

@syskin
Copy link
Contributor

syskin commented May 4, 2022

Hi,

Thank you for your library that we use in our company, it is excellent for our needs.

We are currently using the diff function without options, which returns this type of response. However we find it awkward in our context not to have the unmodified values of an array.

"updatedScope": {
 "value": {"__old": "test", "__new": "dev"},
 "values": [ [" "], ["+", "item1"]]
}

We have tested the full option, which is not adapted to our case because it returns the whole object, with the values out of context.

{
"nonModifiedScope": {...},
"updatedScope": {
 "value": {"__old": "test", "__new": "dev"},
 "values": [ [" ", "item0"], ["+", "item1"]]
}
}

I would like to suggest an improvement that would allow to keep the unmodified values in the diff of an object, without returning the whole object.

This would consist in adding an option, for example keepUnchangedValues: boolean, which would be taken into account here in the same way as the full option, while remaining in the context of modified values.

ideal answer will look like that:

"updatedScope": {
 "value": {"__old": "test", "__new": "dev"},
 "values": [ [" ", "item0"], ["+", "item1"]]
}

What do you think of this option which would bring a lot of clarity in the context of the modified values scope?

@ewoudenberg
Copy link
Collaborator

Thank you, Syskin. That seems like a reasonable change if you want to submit a PR for it. -Eric

@HoldYourWaffle
Copy link

Shouldn't this be closed now that #86 has been merged?

@syskin syskin closed this as completed Jun 29, 2023
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

3 participants