Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi outputs support #39

Open
ghost opened this issue Jul 11, 2019 · 1 comment
Open

Multi outputs support #39

ghost opened this issue Jul 11, 2019 · 1 comment

Comments

@ghost
Copy link

ghost commented Jul 11, 2019

Hello there! The project is really cool~

I want to make an issue

When multiple returns are written in the code, you need to determine if the code can be executed.

like this:

 /**
 * Binary search
 * @param {Array} list
 * @param {Number} element
 * @returns {number}
 */
function indexSearch(list, element) {
    let currentIndex,
        currentElement,
        minIndex = 0,
        maxIndex = list.length - 1;

    while (minIndex <= maxIndex) {
        currentIndex = Math.floor((maxIndex + maxIndex) / 2);
        currentElement = list[currentIndex];

        if (currentElement === element) {
            return currentIndex;
        }

        if (currentElement < element) {
            minIndex = currentIndex + 1;
        }

        if (currentElement > element) {
            maxIndex = currentIndex - 1;
        }
    }
 

  // Please pay attention to these two sentences
  return -1;
  return 0;
}

There are two returns at the end of the code block. According to the actual situation, the last return will never be executed.

image

image

But in the flow chart, the effect is that the second one can still be executed.

Expectations: Ability to present special styles for code that can never be executed.

thanks!

@Bogdan-Lyashenko
Copy link
Owner

Hi @IceyTea, thanks for the reporting; you can use "custom modifiers" (see Readme, https://github.com/Bogdan-Lyashenko/js-code-to-svg-flowchart#flow-tree-modifier, https://github.com/Bogdan-Lyashenko/js-code-to-svg-flowchart#shapes-tree-editor) to do so (i.e. you need to define that rule when you use 'js-code-to-svg-flowchart') there is no native support right now. It's definitely doable, but unfortunately I don't have time now for adding more features to this project; if you are interested in contributing - I definitely will help&guide you so you can implement this feature. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant