You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We made a couple of changes to the original library behavior in relation to elisions rendering you might be also interested in adding to back to your library:
Rendering elisions for objects the similar way they are rendered for arrays. For our use case we found it confusing that the untouched keys are just not showing up in the diff like they didn’t exist. And we though it would be very intuitive to render the placeholders/elisions for extra untouched fields the same way it’s already done for arrays.
We added an extra option showElisionsForObjects which is a boolean we keep turned on by default. Setting it to false allows to use the original behavior of json-diff.
Customizable elisions renderer. The “entries” word is hard-coded into the elision template. We though it would be nice to have it customizable in case anyone would need to add a localization other than English. So we added a generic way of customizing the elisions renderer by providing a renderer function.
Custom renderer takes the elisions counter value, and just forwarded maxElisions value for convenience which can be just ignored. It can return a list of strings which will translate into multiple lines. Or just a single string which will transform into a single line (the same can be achieved by providing a list of one single string).
Here is a patch with the essentials of the change (the patch has a couple of unrelated lines for the piece of React-related code, just ignore them): json-diff-react-elisions.patch.zip
Hi, we forked your library in order to make a React component based on it:
We made a couple of changes to the original library behavior in relation to elisions rendering you might be also interested in adding to back to your library:
Rendering elisions for objects the similar way they are rendered for arrays. For our use case we found it confusing that the untouched keys are just not showing up in the diff like they didn’t exist. And we though it would be very intuitive to render the placeholders/elisions for extra untouched fields the same way it’s already done for arrays.
We added an extra option
showElisionsForObjects
which is a boolean we keep turned on by default. Setting it tofalse
allows to use the original behavior of json-diff.Customizable elisions renderer. The “entries” word is hard-coded into the elision template. We though it would be nice to have it customizable in case anyone would need to add a localization other than English. So we added a generic way of customizing the elisions renderer by providing a renderer function.
Custom renderer takes the elisions counter value, and just forwarded
maxElisions
value for convenience which can be just ignored. It can return a list ofstring
s which will translate into multiple lines. Or just a singlestring
which will transform into a single line (the same can be achieved by providing a list of one singlestring
).Here is a patch with the essentials of the change (the patch has a couple of unrelated lines for the piece of React-related code, just ignore them): json-diff-react-elisions.patch.zip
The patch is produced by this command ran against https://github.com/relex/json-diff-react repo:
The patch contents:
The text was updated successfully, but these errors were encountered: