mattphillips / deep-object-diff

Deep diffs two objects, including nested structures of arrays and objects, and returns the difference. ❄️
https://www.npmjs.com/package/deep-object-diff
MIT License
1.05k stars 89 forks source link

Trim the spaces for string Type #104

Open i-paragsaxena opened 2 months ago

i-paragsaxena commented 2 months ago

While comparing two strings if there is whitespace in the target, it shows as a change and returns a change value, is there any options to trim the string before comparison?

soufianerafik commented 2 months ago

Hi @i-paragsaxena! I'm not sure if I'm understanding this correctly. Technically, strings with differing whitespace are not identical, which is why the library currently shows them as changes. Isn't that the expected behavior? I believe that the library is behaving correctly if it reacts to trailing spaces, unless I'm missing something.

Looking forward to your thoughts :)