Skip to content

Bug - Exception in mustBeQuoted due to weird use of Array as Hashmap #31

@tintinweb

Description

@tintinweb

Hi @glejeune,

trying to use your library with my vscode extension. Problem, the super weird Array hashmap stuff is breaking as the for(var name in this.attributs.items) { will not only return added items but also functionnames. no clue why this does not happen on the console but breaks in vscode (maybe more strict?) but the usage feels a bit strange anyway.

I quickly checked the open PR's and #23 appears to solve that problem with an hasOwnProperty check. I guess there are likely more people having the same issues. #23 is a hack but will probably fix the problem as a short-term solution. Any thoughts on merging it? Otherwise I'll have to switch to a different lib.

TypeError: Cannot read property 'type' of undefined
soljson.js:28
at mustBeQuoted (node_modules/surya/node_modules/graphviz/lib/deps/attributs.js:190:42)
at quoteMe (node_modules/surya/node_modules/graphviz/lib/deps/attributs.js:194:6)
at exports.Attributs.Attributs.to_dot (node_modules/surya/node_modules/graphviz/lib/deps/attributs.js:241:56)
at exports.Graph.Graph.to_dot (node_modules/surya/node_modules/graphviz/lib/deps/graph.js:249:61)
at Object.graph (node_modules/surya/lib/graph.js:462:63)
at Commands.surya (src/features/commands.js:53:29)
at src/extension.js:625:30

it is undefined because the in op returned GetEnumerator which is an array method and not an item. see screenshot. left side contents of the hash-array-thing, right side tooltip contents of name (GetEnumerator). this will later break in mustBeQuoted as GetEnumerator is no valid attrib (was never set by our code).

image

cheers,
tin

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