Skip to content

JSON transform has an error branch condition #50

Open
@wss534857356

Description

else if (to === otherFrom) c.lm--;

seems to have a wrong branch condition.First, it needs to be judged at the top layer that otherTo is not equal to otherFrom:

if (otherFrom !== otherTo) {
          // if otherFrom == otherTo, we don't need to change our op.

and then judge that to must be equal to otherTo, and to must be equal to otherFrom,

...
            } else if (to === otherTo) {
              // if we're both moving in the same direction, tie break
              if ((otherTo > otherFrom && to > from) ||
                  (otherTo < otherFrom && to < from)) {
                if (type === 'right') c.lm++;
              } else {
                if (to > from) c.lm++;
                else if (to === otherFrom) c.lm--;
              }
            }
...

Activity

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions