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
I tried using this diff tool, following the example, like this:
var str = formatter.getStyledDiff(old, new);
The output surprisingly put the "-" sign next to next to the "new" data structure and the "+" sign next to the "old" data structure, which is reverse of what one would expect with the arguments above. I suspect what you intended was more like this:
var str = formatter.getStyledDiff(got, expected);
With these semantics, the "new" value comes first, while the old value comes second. With clear names for the first and second arguments, it becomes clear which argument should have the "-" next to it in the output and which should have the "+".
If "old vs new" semantics were intended, then you should reverse the code accordingly if "got vsexpected" semantics were intended, the docs should be updated to replace valueA and valueB with "got" and "expected" instead.
The text was updated successfully, but these errors were encountered:
This is interesting. objectDiff is currently also using undescriptive names of objectA and objectB, but they intend "old vs new" semantics".
unfunk-diff uses "valueA" and "valueB" in the example. It looks the same, but I see from your source code that you intend "actual vs expected" semantics and reverse the order of the arguments. All the more reason to be clear!
I tried using this diff tool, following the example, like this:
The output surprisingly put the "-" sign next to next to the "new" data structure and the "+" sign next to the "old" data structure, which is reverse of what one would expect with the arguments above. I suspect what you intended was more like this:
With these semantics, the "new" value comes first, while the old value comes second. With clear names for the first and second arguments, it becomes clear which argument should have the "-" next to it in the output and which should have the "+".
If "old vs new" semantics were intended, then you should reverse the code accordingly if "got vsexpected" semantics were intended, the docs should be updated to replace
valueA
andvalueB
with "got" and "expected" instead.The text was updated successfully, but these errors were encountered: