You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was looking into implementing Regex.Escape for JS/TS. Even though it's pretty simple (string.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')) I think it would be better to write a regexEscape helper function at the top of the file and then call it.
I haven't noticed evidence that GenJs currently does this for anything else...I think a generic mechanism to extract helper functions would be useful in a lot of situations.
This would make the rest of the translation simple to write:
I was looking into implementing
Regex.Escape
for JS/TS. Even though it's pretty simple (string.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')
) I think it would be better to write aregexEscape
helper function at the top of the file and then call it.I haven't noticed evidence that
GenJs
currently does this for anything else...I think a generic mechanism to extract helper functions would be useful in a lot of situations.This would make the rest of the translation simple to write:
The main challenges would be
Write
calls there's not currently a way to go back and insert something at the top of the outputWhat do you think? If nothing else we could run all the code through a visitor to decide what to extract before writing anything.
The text was updated successfully, but these errors were encountered: