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.
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
valueAandvalueBwith "got" and "expected" instead.