dyatko / arkit

JavaScript architecture diagrams and dependency graphs
https://arkit.pro
MIT License
952 stars 43 forks source link

TypeError: componentsByName[component.name].push is not a function #940

Open alghouliammar1 opened 2 years ago

alghouliammar1 commented 2 years ago

Bug Description when I try to get the diagram of my NodeJS file I use the command "npx arkit -f .\code\code.js -o code.svg" I got this error
orignalcode\node_modules\arkit\dist\generator.js:124 componentsByName[component.name].push(component); ^

TypeError: componentsByName[component.name].push is not a function

can anyone help me please to get over this error?

smurp commented 1 year ago

ah. I've figured out what the cause is....

When the component happens to have a name which matches one of the method names on Array (in my case it was 'toString' (which was in a file called bower_components/jquery/src/var/toString.js) then push is not a function because the value of componentsByName[component.name] is a Function, not an Array, and so does not have a push function on it.

Just sharing this insight before going to be. Might try to fix this in the morning.