Fix .indexOf()
call on integers when using numbers as node id's
#23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First of all, I'd like to say thank you for this amazing library! Its scope is simply perfect for my use-case.
While implementing
redot
in my project I've used the following dot notation for testing purposes. (Notice how I used integers for my node id's)Converting this digraph to an AST using
redot.parse()
worked absolutely perfectly, however, usingredot.stringify()
to convert the newly generated AST back to a DOT-notation threw an error:After a bit of debugging, I found out that using strings as node id's won't trigger the error so I've implemented an extra step in the
.utilQuotesAndEscaping()
function to ensure compatibility with integers in my local setup. Obviously, this is a temporary solution so I'm proposing these changes directly to you:TL:DR
This PR proposes a small change to convert the
text
parameter of the function.utilQuotesAndEscaping()
to string before trying to call.indexOf()
on it, ensuring the latter function is available in the prototype, thus preventing errors.Thanks for considering my PR! 🙋♂️