Giter VIP home page Giter VIP logo

bogdan-lyashenko / js-code-to-svg-flowchart Goto Github PK

View Code? Open in Web Editor NEW
7.0K 139.0 473.0 13.9 MB

js2flowchart - a visualization library to convert any JavaScript code into beautiful SVG flowchart. Learn other’s code. Design your code. Refactor code. Document code. Explain code.

License: MIT License

JavaScript 100.00%
flowchart svg-flowchart ast javascript svg visualisation learning es6 scheme

js-code-to-svg-flowchart's Introduction

Why? While I've been working on Under-the-hood-ReactJS I spent enormous amount of time on creating schemes. Each change in code or flowchart affects all entire scheme instantly, forcing you to move and align 'broken pieces'. Just repeated manual work...

For multiple files support (and other cool features to simplify codebase learning and documentation) checkout Codecrumbs project I am building right now.

Imagine a library which takes any JS code and generate SVG flowchart from it, works on client and server. Allows you easily adjust styles scheme for your context or demonstrate your code logic from different abstractions levels. Highlighting, destructing whole blocks, custom modifiers for your needs etc.

js2flowchart.js Tweet

MIT Licence npm version

js2flowchart is a tool for generating beautiful SVG flowcharts™ from JavaScript code.

To get started install package from NPM

yarn add js2flowchart

or try it right away at codepen sample, or play with the demo below.

Check out live code editor, paste your code and download SVG file of flowchart!

What does js2flowchart do?

js2flowchart takes your JS code and returns SVG flowchart, works on client/server, support ES6.

Main features:

  • defined abstractions levels to render only import/exports, classes/function names, function dependencies to learn/explain the code step by step.
  • custom abstractions levels support create your own one
  • presentation generator to generate list of SVGs in order to different abstractions levels
  • defined flow tree modifiers to map well-known APIs like i.e. [].map, [].forEach, [].filter to Loop structure on scheme etc.
  • destruction modifier to replace block of code with one shape on scheme
  • custom flow tree modifiers support create your own one
  • flow tree ignore filter to omit some code nodes completely i.e. log lines
  • focus node or entire code logic branch to highlight important section on scheme
  • blur node or entire code logic branch to hide less-important stuff
  • defined styles themes supports choose one you like
  • custom themes support create your own one which fits your context colors better
  • custom colors and styles support provides handy API to change specific styles without boilerplate

Use cases:

  • explain/document your code by flowcharts
  • learn other's code by visual understanding
  • create flowcharts for any process simply described by valid JS syntax

CLI

You can simply generate SVG files from your local JS files using CLI tool. Install js2flowchart globally by running:

yarn global add js2flowchart

Or in a project by running:

yarn add js2flowchart --dev

Open terminal and navigate to needed directory with JS file you want to visualize (e.g. './my-project/main.js'). Run the command (if you installed it globally)

js2flowchart main.js

Or add this to your package.json file:

{
  "scripts": {
    "js2flowchart": "js2flowchart"
  }
}

And run (with either npm or yarn):

yarn run js2flowchart main.js

After script is executed observe log SVG file was created: ./js2flowchart/main.js.svg. SVG file will be placed in new directory '/js2flowchart' near your JS file.

API and examples

You can find sources for examples explained below in docs directory.

In examples only js2flowchart library included explicitly, by <script> tag and accessed by global variable from window to make it simpler to run for you without boilerplate. But feel free to use it through ES6 modules as well, when you have Babel&Webpack local server configured.

/**
* Access APIs when js2flowchart injected into HTML page
*/
const {convertCodeToFlowTree, convertFlowTreeToSvg} = window.js2flowchart;

/**
* or import from node_modules 
*/ 
import {convertCodeToFlowTree, convertFlowTreeToSvg} from 'js2flowchart';//way 1
import * as js2flowchart from 'js2flowchart';//way 2

Default

Here is a code function for classic case Binary search

const code = `function indexSearch(list, element) {
    let currentIndex,
        currentElement,
        minIndex = 0,
        maxIndex = list.length - 1;

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

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

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

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

    return -1;
}`;

let's convert it to SVG(the simplest way):

const svg = js2flowchart.convertCodeToSvg(code);

Result:

If you need to modify default behavior you can split js2flowchart.convertCodeToSvg into two building block:

  • flow tree building
  • shapes printing
const {convertCodeToFlowTree, convertFlowTreeToSvg} = js2flowchart;

const flowTree = convertCodeToFlowTree(code);

const svg = convertFlowTreeToSvg(flowTree);//XML string

or when you need full control create main instances manually:

const {createFlowTreeBuilder, createSVGRender} = js2flowchart;

const flowTreeBuilder = createFlowTreeBuilder(),
    svgRender = createSVGRender();

const flowTree = flowTreeBuilder.build(code),
    shapesTree = svgRender.buildShapesTree(flowTree);

const svg = shapesTree.print();//XML string

See the example running here or check out complete source code of it.

Defined abstraction level

What is called 'abstraction level'? Let's say you would like to omit some details, like, e.g. for given module you are interested only in what the module exports, or, what classes it contains. There is a list of defined levels you can do that with. Accessible by ABSTRACTION_LEVELS interface.

  • FUNCTION
  • FUNCTION_DEPENDENCIES
  • CLASS
  • IMPORT
  • EXPORT

Let's take example with module imports&exports. Below is the code of some print-util.js.

const code = `
    import {format, trim} from 'formattier';
    import {log} from 'logger';

    const data = [];

    export default print = (list) => {
        list.forEach(i => {
            console.log(i);
        });
    }

    export const formatString = (str) => formatter(str);
    export const MAX_STR_LENGTH = 15;
`;

we need to instantiate flowTreeBuilder and assign abstraction level on it.

    const {
        ABSTRACTION_LEVELS,  createFlowTreeBuilder, convertFlowTreeToSvg
    } = js2flowchart;

    const flowTreeBuilder = createFlowTreeBuilder();

    //you can pass one level or multiple levels
    flowTreeBuilder.setAbstractionLevel([
        ABSTRACTION_LEVELS.IMPORT,
        ABSTRACTION_LEVELS.EXPORT
    ]);

    const flowTree = flowTreeBuilder.build(code);
    const svg = convertFlowTreeToSvg(flowTree);

Result:

See the example running here or check out complete source code of it.

Custom abstraction level (label:advanced)

What if you want your 'own' level? To the same API endpoint flowTreeBuilder.setAbstractionLevel you can provide configuration object. For example, have a look at the code of function dependencies abstraction level. Check out the export of it

export const getFunctionDependenciesLevel = () => ({
    defined: [TOKEN_TYPES.CALL_EXPRESSION],
    custom: [
        getCustomFunctionDeclaration(),
        getCustomAssignmentExpression(),
        getCustomVariableDeclarator()
    ]
});

It's a format of data you need to pass:

flowTreeBuilder.setAbstractionLevel({
    defined: [TOKEN_TYPES.CALL_EXPRESSION],
    custom: [
        getCustomFunctionDeclaration(),
        getCustomAssignmentExpression(),
        getCustomVariableDeclarator()
    ]
})

And what is behind of getCustomAssignmentExpression for example? There is a token parsing config.

{
    type: 'TokenType', /*see types in TOKEN_TYPES map*/
    getName: (path) => {/*extract name from token*/},
    ignore: (path) => {/*return true if want to omit entry*/}
    body: true /* should it contain nested blocks? */
}

Check out more token parsing configs from source code (entryDefinitionsMap.js)

Presentation generator

When you learn other's code it's good to go through it by different abstractions levels. Take a look what module exports, which function and classes contains etc. There is a sub-module createPresentationGenerator to generate list of SVGs in order to different abstractions levels.

Let's take the next code for example:

const code = `
    import {format} from './util/string';

    function formatName(name) {
        if (!name) return 'no-name';

        return format(name);
    }

    class Animal {
        constructor(breed) {
            this.breed = breed;
        }

        getBreed() {
            return this.breed;
        }

        setName(name) {
            if (this.nameExist()) {
                return;
            }

            this.name = name;
        }
    }

    class Man extends Animal {
       sayName() {
            console.log('name', this.name);
       }
    }

    export default Man;
`;

pass it to

const { createPresentationGenerator } = js2flowchart;

const presentationGenerator = createPresentationGenerator(code);
const slides = presentationGenerator.buildSlides();//array of SVGs

Result (one of slides):

You can switch slides by prev-next buttons.

See the example running here or check out complete source code of it.

Defined colors theme

You can apply different themes to your svgRender instance. Simply calling e.g. svgRender.applyLightTheme() to apply light scheme.

There are next predefined color schemes:

  • DEFAULT: applyDefaultTheme
  • BLACK_AND_WHITE: applyBlackAndWhiteTheme
  • BLURRED: applyBlurredTheme
  • LIGHT: applyLightTheme

Let's simple code sample of switch statement from Mozzila Web Docs.

const code = `
    function switchSampleFromMDN() {
        const foo = 0;

        switch (foo) {
          case -1:
            console.log('negative 1');
            break;
          case 0:
            console.log(0);
          case 1:
            console.log(1);
            return 1;
          default:
            console.log('default');
        }
    }
`;

and apply scheme to render.

const {createSVGRender, convertCodeToFlowTree} = js2flowchart;

const flowTree = convertCodeToFlowTree(code),
    svgRender = createSVGRender();

//applying another theme for render
svgRender.applyLightTheme();

const svg = svgRender.buildShapesTree(flowTree).print();

Result:

See the example running here or check out complete source code of it.

Custom colors theme

Well, but what if you would like to have different colors? Sure, below is an example of Light theme colors but created manually.

svgRender.applyColorBasedTheme({
   strokeColor: '#555',
   defaultFillColor: '#fff',
   textColor: '#333',
   arrowFillColor: '#444',
   rectangleFillColor: '#bbdefb',
   rectangleDotFillColor: '#ede7f6',
   functionFillColor: '#c8e6c9',
   rootCircleFillColor: '#fff9c4',
   loopFillColor: '#d1c4e9',
   conditionFillColor: '#e1bee7',
   destructedNodeFillColor: '#ffecb3',
   classFillColor: '#b2dfdb',
   debuggerFillColor: '#ffcdd2',
   exportFillColor: '#b3e5fc',
   throwFillColor: '#ffccbc',
   tryFillColor: '#FFE082',
   objectFillColor: '#d1c4e9',
   callFillColor: '#dcedc8',
   debugModeFillColor: '#666'
});

Custom styles

What if you need different styles, not only colors? Here it's svgRender.applyTheme({}). You can apply styles above of current theme, overriding only that behaviour you need. Let's take an example with Return statement.

svgRender.applyTheme({
    common: {
        maxNameLength: 100
    },
    ReturnStatement: {
        fillColor: 'red',
        roundBorder: 10
    }
});

Please check definition of DefaultBaseTheme to see all possible shapes names and properties.

Shapes tree editor

There is sub-module for modifying shapes tree called 'ShapesTreeEditor'. It provides next interfaces:

  • findShape
  • applyShapeStyles
  • blur
  • focus
  • blurShapeBranch
  • focusShapeBranch
  • print

Let's learn its usage on an example as well. Below is the code with some 'devMode hooks'.

const code = `
const doStuff = (stuff) => {
    if (stuff) {
        if (devFlag) {
            log('perf start');
            doRecursion();
            log('perf end');

            return;
        }

        doRecursion();
        end();
    } else {
        throw new Error('No stuff!');
    }

    return null;
};
`;

what we want here is 'blur' that dev-branch condition, because it interferes code readability.

const {
    convertCodeToFlowTree,
    createSVGRender,
    createShapesTreeEditor
} = js2flowchart;

const flowTree = convertCodeToFlowTree(code),
    svgRender = createSVGRender();
    shapesTree = svgRender.buildShapesTree(flowTree);

const shapesTreeEditor = createShapesTreeEditor(shapesTree);

shapesTreeEditor.blurShapeBranch(
    (shape) => shape.getName() === '(devFlag)'
);

const svg = shapesTreeEditor.print();

Result:

See the example running here or check out complete source code of it.

Flow tree modifier

There is sub-module for modifying flow tree called 'FlowTreeModifier' which allows you to apply modifiers defined separately to your existing flow tree. Let's take simple use-case: you want to change 'names'(titles) on tree-nodes, here it is, just define modifier for that. But, actually, there are some behaviours where we already know we need to modify flow tree.

Let's have a look at ES5 Array iterators, like forEach, map and so on. We all know they behave like a loop, right? Let's treat them as a 'loop' then.

const code = `
function print(list) {
    const newList = list.map(i => {
        return i + 1;
    });

    newList.forEach(i => {
        console.debug('iteration start');
        console.log(i);
        console.debug('iteration end');
    });
}
`;
const {
    createFlowTreeBuilder,
    createFlowTreeModifier,
    convertFlowTreeToSvg,
    MODIFIER_PRESETS
} = js2flowchart;

const flowTreeBuilder = createFlowTreeBuilder(),
    flowTree = flowTreeBuilder.build(code);

const flowTreeModifier = createFlowTreeModifier();

flowTreeModifier.setModifier(MODIFIER_PRESETS.es5ArrayIterators);
flowTreeModifier.applyToFlowTree(flowTree);

const svg = convertFlowTreeToSvg(flowTree);

Result:

As you can see, both iterators handled as a loop. And forEach omit function-callback as well.

See the example running here or check out complete source code of it.

There is one more defined modifier for node destruction. It takes a block you specified and destruct it to on block.

flowTreeModifier.destructNodeTree((node) => node.name.indexOf('.forEach') !== -1, 'and print list...');

What if you want custom modifier?

flowTreeModifier.registerNewModifier((node)=> node.name.includes('hello'), {
    name: 'world'
});

Debug rendering

What if you want to select a shape for applying special styles and want some unique id selector? Just pass debug flag to print;

    const {
        convertCodeToFlowTree,
        createSVGRender,
        createShapesTreeEditor
    } = js2flowchart;

    const svgRender = createSVGRender();

    const shapesTree = svgRender.buildShapesTree(convertCodeToFlowTree(code));
    const shapesTreeEditor = createShapesTreeEditor(shapesTree);

    shapesTreeEditor.applyShapeStyles(
        shape => shape.getNodePathId() === 'NODE-ID:|THIS.NAME=N|TCCP-', {
        fillColor: '#90caf9'
    });

    const svg = shapesTreeEditor.print({debug: true});

Result:

See the example running here or check out complete source code of it.

Tools

Thanks to @LucasBadico we got Visual Studio extension. Check it out.

Under the hood

Main stages:

  • get AST from code, Babylon parser is used (develops by Babel team)
  • convert AST to FlowTree, remove and combing nodes (FlowTreeBuilder)
  • create SVG objects based on FlowTree (SVGRender)
  • print SVG objects to XML string

Things planned TODO

  • Full CLI support
  • JSX support
  • Flow support
  • TypeScript support
  • Multi files support
  • Webstorm plugin
  • Chrome extension for dev-tools

Contributing

Feel free to file an issue if it doesn't work for your code sample (please add 'breaking' lines of code if it's possible to identify) or for any other things you think can be improved. Highly appreciated if you can join and help with any TODOs above. Thanks.

License

MIT license

Version

First shoot! Take it easy (check version number above in NPM badge)

js-code-to-svg-flowchart's People

Contributors

berkmann18 avatar bogdan-lyashenko avatar jackbennett avatar jason-cooke avatar jellydn avatar stephenfeather avatar tomyfalgui avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

js-code-to-svg-flowchart's Issues

Breaks if trying to render a file in a subdirectory.

For sanity, I tried to keep the custom js2flowchart subfolder, which is a little a pain already, concise by rendering from the root of my project:

~/https/github.com/xyz (gh-pages) $ cd scripts 
~/https/github.com/xyz/scripts (gh-pages) $ js2flowchart map.js
SVG file was created: ./js2flowchart/map.js.svg
~/https/github.com/xyz/scripts (gh-pages*) $ cd ..
~/https/github.com/xyz (gh-pages*) $ js2flowchart scripts/map.js
{ Error: ENOENT: no such file or directory, open './js2flowchart/scripts/map.js.svg'
    at Error (native)
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: './js2flowchart/scripts/map.js.svg' }

Apparently this is just not possible, as the script seems to reuse the JS file's path completely for the SVG, including path fragments and not relying on mkdir -p-like behaviour.

Small issues with the sample (binary search)

First issue is a typo of the algorithm. The line
currentIndex = Math.floor((maxIndex + maxIndex) / 2);
should be with min instead of max:
currentIndex = Math.floor((minIndex + maxIndex) / 2);

Second issue is that the arrow that returns into the while comes from the true branch of the last if statement instead of coming from both branches. It's an obvious mistake for an experienced developer, but it is weird for someone who is learning how to write programs.

Did NPM global install - can see it & it doesn't run

I forked your codepen & got it to work - but integrating via the CLI locally on my machine to run or dropping your js2flowchart.js don't seem to work ... perhaps the readme & examples folder is out of date? (https://github.com/Bogdan-Lyashenko/js-code-to-svg-flowchart#cli)

Have tried:

npm run ...
npm js2flowchart ...
js2flowchart ...
npm run-script js2flowchart ...

[email protected] C:\Program Files\nodejs\node_modules\npm

mirvdesign@mirvdesign-PC MINGW64 /c/Sites/flowChart/ensemble/mapping (master)
$ npm run-script js2flowchart t_t.js
npm ERR! missing script: js2flowchart

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\mirvdesign\AppData\Roaming\npm-cache\_logs\2020-03-27T00_37_34_046Z-debug.log

mirvdesign@mirvdesign-PC MINGW64 /c/Sites/flowChart/ensemble/mapping (master)
$ npm list -g | grep js2flowchart
+-- [email protected]

Project support

I've seen that the multi-file support was on the TODO list but as that could mean supporting * ops (e.g: *.js) as well as projects, I was wondering which one it was and if it was the latter, then my question would be:
Will it know about the data-structures that a module (e.g: main.js) uses from another one (regardless of whether it's NodeJS/ES6 modules?
Example in NodeJS (the same could be said for ES6 modules):
main.js

let aModule = require('./aModule');

// some code here
aModule.doSomething();

I'm aware that the latter would possibly require a filter to prevent this generator to go deep in the (yarn|node)_modules or any library files that aren't really part of the project so I'm willing to help (if there's need).

init state - Foor loops

At for loops its not showing the init state of the loop itself, yet it just shows the loop.

for (let i=0; i < 10; i++) {
doThings()
} 

Like this part of code.

not every for loop start from ZERO.

javascript to flowchart, misses return loop

Hi Bogdan.
Apologies if the following is a waste of time, but I may have found an issue with your otherwise excellent code to convert javascript to a flow chart. First let me say I am not a programmer, more of a power user that is trying to build a google apps script for voluntary organisation. Everything worked fine except that the <<...if match == no....>>
test at the bottom of the flowchart loops back into another iteration whether the answer is true or false and the diagram does not show this. (the code does loop when tested!) It may be this is what you intended and that your documentation says it somewhere else. If so, apologies again. Attached is the source.
It did not affect the usefulness of this software, but I thought you might like to know
(To all the expert programmers out there - I know my code is probably clumsy, but I am really finding may way around this at the moment!!!!)

add new user for github.txt

Spanish Translation

Hello! I would like to translate the project into Spanish! is it already translated?

ES6 parsing issues

These two code blocks should render the same tree

// works as expected
const a = () => {
  return b()
}

image

// does not work as expected
const a = () => b()

image

Switch in if/else problem

Found this funny using one of your examples...

Duplicated the switch statement, one in the if the other in the else. The IF switch renders fine the ELSE renders wrong.

screenshot 2019-03-06 at 14 24 33

const code = `
function switchSampleFromMDN() {
const foo = 0;
const bar = 0;

    if (bar > 10) {
        switch (foo) {
        case -1:
            console.log('negative 1');
            break;
        case 0:
            console.log(0);
        case 1:
            console.log(1);
            return 1;
        default:
            console.log('default');
        }
    }
    else {
        switch (foo) {
        case -1:
            console.log('negative 1');
            break;
        case 0:
            console.log(0);
        case 1:
            console.log(1);
            return 1;
        default:
            console.log('default');
        }
    }
}

`;

Is typescript supported yet? seems to work

I clone this repo and try to run on a typescript file and it works.
Could you tell what's lacking with typescript support?
Therefore, I could avoid using it with those unsupported cases.

Thanks for this awesome project. It's really a time saver.

Show comments in Diagram

I have a scenario where Iwant to show comments in the node's tooltip
Ex :

//This is add function
function add(a,b)

So the node for function should show its comments in tooltip .

Internal Binding Error: this.input.charCodeAt is not a function

Error at parseCodeToAST: this.input.charCodeAt is not a function
node:internal/process/esm_loader:108
internalBinding('errors').triggerUncaughtException(
^

TypeError: this.input.charCodeAt is not a function


TypeError: this.input.charCodeAt is not a function
at at.skipSpace (\js2flowchart\dist\js2flowchart.js:1:214760)
at at.nextToken (
\js2flowchart\dist\js2flowchart.js:1:213390)
at at.parse (\js2flowchart\dist\js2flowchart.js:1:298151)
at t.parse (
\js2flowchart\dist\js2flowchart.js:1:299385)
at Y (\js2flowchart\dist\js2flowchart.js:8:131355)
at Object.buildAst (
\js2flowchart\dist\js2flowchart.js:8:140579)
at Object.build (\js2flowchart\dist\js2flowchart.js:8:140502)
at file:///
/js2Flowchart.js:37:34
at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
at async Promise.all (index 0)

Syntax error

I was working on a file and got weird error (which i could not read) on this line:

for (let [j, element] of sub.entries()) {}

when i have a similar syntax the tool is not working.

Prototype pollution

After running an audit on a package (HashMyJS), NPM flagged 4 vulnerabilities of the same type all caused by lodash, here's the output:

┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low           │ Prototype Pollution                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ lodash                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ js2flowchart [dev]                                           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ js2flowchart > babel-core > babel-generator > babel-types >  │
│               │ lodash                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/577                       │
└───────────────┴──────────────────────────────────────────────────────────────┘


┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low           │ Prototype Pollution                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ lodash                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ js2flowchart [dev]                                           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ js2flowchart > babel-core > babel-generator > lodash         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/577                       │
└───────────────┴──────────────────────────────────────────────────────────────┘


┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low           │ Prototype Pollution                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ lodash                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ js2flowchart [dev]                                           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ js2flowchart > babel-generator > babel-types > lodash        │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/577                       │
└───────────────┴──────────────────────────────────────────────────────────────┘


┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low           │ Prototype Pollution                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ lodash                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ js2flowchart [dev]                                           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ js2flowchart > babel-generator > lodash                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/577                       │
└───────────────┴──────────────────────────────────────────

I flagged this issue at babel (cf. here).

TypeScript support

Just adding an issue to keep track of any progress towards supporting TypeScript. <3

specific output

instead of only having an SVG file as output it would be great to define a specific output like png or etc.

this feature can be added to CLI as well :)

Webpack build/dev errors

Not sure if it's to do with the deprecation that webpack had (which changes how build/dev processes work) or to do with babel (which if I recall correctly recommend using the babel-plugin-env instead of babel-plugin-es2015 since Babel v7).
I'm trying to run npm run build and npm run dev which respectively outputs:

> [email protected] build /mnt/c/Users/max/Projects/js-code-to-svg-flowchart
> webpack --env build

Hash: 32fe82ee19a139c705de
Version: webpack 4.22.0
Time: 276ms
Built at: 2018-10-23 10:50:06
              Asset      Size  Chunks             Chunk Names
    js2flowchart.js  7.01 KiB    main  [emitted]  main
js2flowchart.js.map  4.11 KiB    main  [emitted]  main
Entrypoint main = js2flowchart.js js2flowchart.js.map
[./index.js] 2.84 KiB {main} [built] [failed] [1 error]

ERROR in ./index.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Cannot find module 'babel-core'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Module.require (module.js:597:17)
    at require (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/babel-loader/lib/index.js:3:13)
    at Module._compile (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at loadLoader (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/loader-runner/lib/loadLoader.js:13:17)
    at iteratePitchingLoaders (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at runLoaders (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/loader-runner/lib/LoaderRunner.js:362:2)
    at NormalModule.doBuild (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/webpack/lib/NormalModule.js:265:3)
    at NormalModule.build (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/webpack/lib/NormalModule.js:412:15)
    at Compilation.buildModule (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/webpack/lib/Compilation.js:626:10)
    at moduleFactory.create (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/webpack/lib/Compilation.js:1012:12)
    at factory (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/webpack/lib/NormalModuleFactory.js:405:6)
    at hooks.afterResolve.callAsync (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/webpack/lib/NormalModuleFactory.js:155:13)
    at AsyncSeriesWaterfallHook.eval [as callAsync] (eval at create (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:6:1)
    at AsyncSeriesWaterfallHook.lazyCompileHook (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/tapable/lib/Hook.js:154:20)
    at resolver (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/webpack/lib/NormalModuleFactory.js:138:29)
    at process.nextTick (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/webpack/lib/NormalModuleFactory.js:342:9)
    at _combinedTickCallback (internal/process/next_tick.js:132:7)
    at process._tickCallback (internal/process/next_tick.js:181:9)
> [email protected] dev /mnt/c/Users/max/Projects/js-code-to-svg-flowchart
> webpack --progress --colors --watch --env dev


webpack is watching the files…

Hash: 32fe82ee19a139c705de
Version: webpack 4.22.0
Time: 353ms
Built at: 2018-10-23 10:48:56
              Asset      Size  Chunks             Chunk Names
    js2flowchart.js  7.01 KiB    main  [emitted]  main
js2flowchart.js.map  4.11 KiB    main  [emitted]  main
Entrypoint main = js2flowchart.js js2flowchart.js.map
[./index.js] 2.84 KiB {main} [built] [failed] [1 error]

ERROR in ./index.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Cannot find module 'babel-core'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Module.require (module.js:597:17)
    at require (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/babel-loader/lib/index.js:3:13)
    at Module._compile (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at loadLoader (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/loader-runner/lib/loadLoader.js:13:17)
    at iteratePitchingLoaders (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at runLoaders (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/loader-runner/lib/LoaderRunner.js:362:2)
    at NormalModule.doBuild (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/webpack/lib/NormalModule.js:265:3)
    at NormalModule.build (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/webpack/lib/NormalModule.js:412:15)
    at Compilation.buildModule (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/webpack/lib/Compilation.js:626:10)
    at moduleFactory.create (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/webpack/lib/Compilation.js:1012:12)
    at factory (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/webpack/lib/NormalModuleFactory.js:405:6)
    at hooks.afterResolve.callAsync (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/webpack/lib/NormalModuleFactory.js:155:13)
    at AsyncSeriesWaterfallHook.eval [as callAsync] (eval at create (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:6:1)
    at AsyncSeriesWaterfallHook.lazyCompileHook (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/tapable/lib/Hook.js:154:20)
    at resolver (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/webpack/lib/NormalModuleFactory.js:138:29)
    at process.nextTick (/mnt/c/Users/max/Projects/js-code-to-svg-flowchart/node_modules/webpack/lib/NormalModuleFactory.js:342:9)
    at _combinedTickCallback (internal/process/next_tick.js:132:7)
    at process._tickCallback (internal/process/next_tick.js:181:9)

EDIT: After looking at the module list (npm ls --depth=0), I noticed this:

 UNMET PEER DEPENDENCY babel-core@6 || 7 || ^7.0.0-alpha || ^7.0.0-beta || ^7.0.0-rc
UNMET PEER DEPENDENCY [email protected] 

npm ERR! peer dep missing: webpack@2, required by [email protected]
npm ERR! peer dep missing: babel-core@6 || 7 || ^7.0.0-alpha || ^7.0.0-beta || ^7.0.0-rc, required by [email protected]   

Width problem of multibyte characters

The width of multibyte characters text like emoji, Japanese, Chinese over the width of background shape.

image

Reproduce code:

while("♥♥♥♥♥♥♥♥♥♥"){
  
}

DO WHILE loop is not working

Hi @Bogdan-Lyashenko

I have simple do while loop. i am trying to generate the chart,that chart i am not able see the 'do'.

function Recorder() {
var i = 1;
do
{
i++;
console.log(i);
}
while(i<=10);
{

}
}

Please help me solve this.
Thanks.

“yarn global add js2flowchart” Error executing command

The Error is:

yarn global v1.21.0
[1/4] Resolving packages...
[2/4] Fetching packages...
error An unexpected error occurred: "C:\Users\...\npm-@babel-parser-7.9.4-68a35e6b0319bbc014465be43828300113f2f2e8-integrity\node_modules\@babel\parser\.yarn-metadata.json: Unexpected token \u0000 in JSON at position 0".
info If you think this is a bug, please open a bug report with the information provided in "C:\Users\...\Yarn\Data\global\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.

AST error on a file

I'm working on a project and when I'm trying to generate the flowchart for all files, everything but one goes well.
I haven't properly dug into the code as I'm really busy at the moment but thought it would be better to have this issue known.

Error at buildFlowTreeFromAstt.isTSTypeAssertion is not a function
                                                                                       /mnt/c/Users/max/Projects/hashmyjs/node_modules/js2flowchart/dist/js2flowchart.js:39700
                                                                                            throw e;
                                                                                                                                                                ^
                                                                                                                                                                                                                                                                                                                               TypeError: t.isTSTypeAssertion is not a function
                                                                                                                            at ConditionalExpression (/mnt/c/Users/max/Projects/hashmyjs/node_modules/js2flowchart/dist/js2flowchart.js:3916:82)
                                                    at ArrowFunctionExpression (/mnt/c/Users/max/Projects/hashmyjs/node_modules/js2flowchart/dist/js2flowchart.js:3910:43)
                                                  at find (/mnt/c/Users/max/Projects/hashmyjs/node_modules/js2flowchart/dist/js2flowchart.js:3695:15)
                                                                     at Object.needsParens (/mnt/c/Users/max/Projects/hashmyjs/node_modules/js2flowchart/dist/js2flowchart.js:3748:10)
                                                       at Generator.print (/mnt/c/Users/max/Projects/hashmyjs/node_modules/js2flowchart/dist/js2flowchart.js:4497:25)
                                                          at Generator.printJoin (/mnt/c/Users/max/Projects/hashmyjs/node_modules/js2flowchart/dist/js2flowchart.js:4576:12)
                                                      at Generator.printList (/mnt/c/Users/max/Projects/hashmyjs/node_modules/js2flowchart/dist/js2flowchart.js:4648:17)
                                                      at Generator.CallExpression (/mnt/c/Users/max/Projects/hashmyjs/node_modules/js2flowchart/dist/js2flowchart.js:1019:8)
                                                  at /mnt/c/Users/max/Projects/hashmyjs/node_modules/js2flowchart/dist/js2flowchart.js:4509:23
                                                                            at Buffer.withSource (/mnt/c/Users/max/Projects/hashmyjs/node_modules/js2flowchart/dist/js2flowchart.js:614:28)

Ternay operator

Another bug at this one it does not show the flowchart properly.

let max = min + verseInPage >= dataArr.length ? dataArr.length : min + verseInPage;
test js

Mistake in example

line 14 Math.floor(maxIndex + maxIndex) / 2
should be Math.floor((maxIndex + maxIndex) / 2)

missing code at the end

return React.createElement(
      ApolloProvider,
      { client: client },
      React.createElement(
MyNews, null)
    );

throws something like:

image
without error.

I tested it with online editor and got the same behavior.

CLI ETA?

Hey,

Thanks for this one!
I'd like to test on a React Native using CLI.
Is there an ETA?
Pasting in a code editor didn't work :(

Unresolved theme

What happened

After modifying index.cli.js (to add the features the non-CLI part has) and adding prettier as a dev dependency as this project would need to explicitly list what it needs for the development and I didn't had prettier before running npm run pretty (to prettify index.cli.js which wasn't included in the list of scripts to prettify (I assume it's intentional?).

Then when I tried to run

npm run dev

To test my changes (I've only added the abstraction level support for the CLI app for now).
I then had the following output:

> [email protected] dev /home/maxie/Dropbox/Contribs/js-code-to-svg-flowchart
> webpack --progress --colors --watch --env dev

  0% compiling
Webpack is watching the files…

Hash: 899081726ffba20abcdf                                                              
Version: webpack 3.1.0
Time: 2688ms
              Asset     Size  Chunks                    Chunk Names
    js2flowchart.js   1.2 MB       0  [emitted]  [big]  main
js2flowchart.js.map  1.53 MB       0  [emitted]         main
   [4] ./src/shared/constants.js 2.86 kB {0} [built]
  [68] ./src/builder/entryDefinitionsMap.js 11.2 kB {0} [built]
 [110] ./src/shared/utils/logger.js 175 bytes {0} [built]
 [111] ./src/shared/utils/traversal.js 1.52 kB {0} [built]
 [114] ./src/builder/FlowTreeBuilder.js 4.8 kB {0} [built]
 [180] ./src/builder/astBuilder.js 4.84 kB {0} [built]
 [183] ./src/render/svg/SVGRender.js 5.44 kB {0} [built]
 [184] ./src/shared/utils/flatten.js 583 bytes {0} [built]
 [187] ./index.js 2.4 kB {0} [built]
 [447] ./src/builder/abstractionLevelsConfigurator.js 2.37 kB {0} [built]
 [449] ./src/builder/FlowTreeModifier.js 2.14 kB {0} [built]
 [450] ./src/builder/modifiers/modifiersFactory.js 4.14 kB {0} [built]
 [451] ./src/render/svg/appearance/StyleThemeFactory.js 2.69 kB {0} [built]
 [454] ./src/render/svg/svgObjectsBuilder.js 6.48 kB {0} [built]
 [483] ./src/presentation-generator/PresentationGenerator.js 2.94 kB {0} [built]
    + 469 hidden modules

ERROR in ./src/render/svg/appearance/StyleThemeFactory.js
Module not found: Error: Can't resolve './themes/LIGHT' in '/home/maxie/Dropbox/Contribs/js-code-to-svg-flowchart/src/render/svg/appearance'
 @ ./src/render/svg/appearance/StyleThemeFactory.js 24:13-38
 @ ./src/render/svg/SVGRender.js
 @ ./index.js
Hash: c49ab773c1535172d5a7                                                         
Version: webpack 3.1.0
Time: 545ms
              Asset     Size  Chunks                    Chunk Names
    js2flowchart.js   1.2 MB       0  [emitted]  [big]  main
js2flowchart.js.map  1.53 MB       0  [emitted]         main
 [451] ./src/render/svg/appearance/StyleThemeFactory.js 2.69 kB {0} [built]
 [484] ./src/render/svg/appearance/themes/Light.js 867 bytes {0} [built]
    + 483 hidden modules

What I tried

I then modified the StyleThemeFactory.js file to fix that issue

Environment

OS: Linux 4.13 64-bit ArchLinux
Terminal: xfce4-terminal (that uses bash)

For in Failure

function test () { let demo = {'A': 1, 'B': 2} for (let key in demo) { } }

The diagram on the online demo fails to change unless change condition declaration:

function test2 () { let demo = {'A': 1, 'B': 2} let key for (key in demo) { } }

Multi outputs support

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!

ES6 Destructuring Broken

As of the current version, array destructuring seems to be broken in some cases.

Works fine:

const [a, b, c] = foo;

This renders as
schermafbeelding 2017-11-15 om 16 30 29

However, changing it to the following breaks it:

const [a, b, c] = foo();

As you can see, it now renders the lefthand as undefined:
schermafbeelding 2017-11-15 om 16 31 30

JSX recognition - is in the plans?

captura de tela 2017-11-08 as 23 57 10
Hey guys, jsx is on the roadmap for the tool? If it is I want to make. Just made a visual studio extension with this, but for really be useful I need the jsx be parsed together with the js.

Separate each function

It would be great to have options for the CLI, like show each function separately on SVG file or even being able to read from an external config file for options.

js2flowchart CLI doesn't work

Hi,

First, thank you for your work!

Secondly, I got a try and I do have some issue with making it running.

This is how I test it.

  • Got an Ubuntu 16.04 LTS.

  • Installed yarn as this resource describes:

[(https://stackoverflow.com/questions/42606941/install-yarn-ubuntu-16-04-linux-mint-18-1) ]

  • Got this JS file, masonry.min.js, as a test bed. [https://masonry.desandro.com/]

This is the error which I got:

js2flowchart masonry.min.js 
Error at buildFlowTreeFromAst[_constants.TOKEN_KEYS.CONSEQUENT,_constants.TOKEN_KEYS.ALTERNATE].includes is not a function
/usr/local/share/.config/yarn/global/node_modules/js2flowchart/dist/js2flowchart.js:7465
                throw e;
                ^

TypeError: [_constants.TOKEN_KEYS.CONSEQUENT,_constants.TOKEN_KEYS.ALTERNATE].includes is not a function
    at Object.singleTypeFilter [as ignore] (/usr/local/share/.config/yarn/global/node_modules/js2flowchart/dist/js2flowchart.js:4266:77)
    at /usr/local/share/.config/yarn/global/node_modules/js2flowchart/dist/js2flowchart.js:18165:33
    at /usr/local/share/.config/yarn/global/node_modules/js2flowchart/dist/js2flowchart.js:18144:20
    at NodePath._call (/usr/local/share/.config/yarn/global/node_modules/js2flowchart/dist/js2flowchart.js:29049:18)
    at NodePath.call (/usr/local/share/.config/yarn/global/node_modules/js2flowchart/dist/js2flowchart.js:29021:17)
    at NodePath.visit (/usr/local/share/.config/yarn/global/node_modules/js2flowchart/dist/js2flowchart.js:29078:12)
    at TraversalContext.visitQueue (/usr/local/share/.config/yarn/global/node_modules/js2flowchart/dist/js2flowchart.js:30339:16)
    at TraversalContext.visitMultiple (/usr/local/share/.config/yarn/global/node_modules/js2flowchart/dist/js2flowchart.js:30292:17)
    at TraversalContext.visit (/usr/local/share/.config/yarn/global/node_modules/js2flowchart/dist/js2flowchart.js:30379:19)
    at Function.traverse.node (/usr/local/share/.config/yarn/global/node_modules/js2flowchart/dist/js2flowchart.js:2646:17)

Any ideas why I'm getting this?

Thanks.

Error parsing react component

When I tried to parse my first jsx, I got this error but I see no reference to classProperties in github documentation. Am I missing something?

Error at parseCodeToAST: This experimental syntax requires enabling the parser plugin: 'classProperties' (29:21)
<user-home>/.config/yarn/global/node_modules/js2flowchart/dist/js2flowchart.js:40029
        throw e;
        ^

SyntaxError: This experimental syntax requires enabling the parser plugin: 'classProperties' (29:21)
    at _class.raise (/Users/bkarumuri/.config/yarn/global/node_modules/js2flowchart/dist/js2flowchart.js:15623:15)
    at _class.expectPlugin (/Users/bkarumuri/.config/yarn/global/node_modules/js2flowchart/dist/js2flowchart.js:16913:18)
    at _class.parseClassProperty (/Users/bkarumuri/.config/yarn/global/node_modules/js2flowchart/dist/js2flowchart.js:19716:12)
    at _class.parseClassProperty (/Users/bkarumuri/.config/yarn/global/node_modules/js2flowchart/dist/js2flowchart.js:24483:55)
    at _class.pushClassProperty (/Users/bkarumuri/.config/yarn/global/node_modules/js2flowchart/dist/js2flowchart.js:19683:30)
    at _class.parseClassMemberWithIsStatic (/Users/bkarumuri/.config/yarn/global/node_modules/js2flowchart/dist/js2flowchart.js:19616:14)
    at _class.parseClassMemberWithIsStatic (/Users/bkarumuri/.config/yarn/global/node_modules/js2flowchart/dist/js2flowchart.js:24389:58)
    at _class.parseClassMember (/Users/bkarumuri/.config/yarn/global/node_modules/js2flowchart/dist/js2flowchart.js:19553:10)
    at _class.parseClassMember (/Users/bkarumuri/.config/yarn/global/node_modules/js2flowchart/dist/js2flowchart.js:24346:46)
    at _class.parseClassBody (/Users/bkarumuri/.config/yarn/global/node_modules/js2flowchart/dist/js2flowchart.js:19508:12)

`for(;;)` is not handled.

function q() {
    for(;;) {
    	console.log("dsfsdf"); 
    }
}

The diagram on the online demo fails to change unless I add loop condition.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.