Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape doesn't escape anything at all when using double quotes #5

Open
kornelski opened this issue Feb 27, 2017 · 1 comment
Open

Comments

@kornelski
Copy link

kornelski commented Feb 27, 2017

return str.replace(/"/g, '"');

return str.replace(/"/g, '"');

The replacement string was probably meant to be '\\"'.

The code should be

return str.replace(/\\/g, '\\\\').replace(/"/g, '\\"');

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@wzrdtales
Copy link
Member

@pornel Yes you're right, that wont work quite well though. Thanks for point out :) Feel free to open a PR if you want to, I will have a look at this later on though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants