Skip to content

In docs, "valueA" and "valueB" should have more descriptive names #4

Description

@markstos

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions