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

better regex for replacing single quotes #263

Merged
merged 2 commits into from
Feb 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions builder/parameter_hunter.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
var rightParen = pMatch.indexOf(')');
var paramString = '{' + pMatch.substring(leftParen + 1, rightParen) + '}';
//if param keys are wrapped in single quotes, replace with double quotes.
var paramStringWellFormed = paramString.replace(/(')([^']+)(')(\s*\:)/gm, '"$2"$4');
var paramStringWellFormed = paramString.replace(/(')([^']+)(')(\s*\:)/g, '"$2"$4');
//if params keys are not wrapped in any quotes, wrap in double quotes.
var paramStringWellFormed = paramStringWellFormed.replace(/([\{|,]\s*)([^\:\s]+)(\s*\:)/gm, '$1"$2"$3');
var paramStringWellFormed = paramStringWellFormed.replace(/([\{|,]\s*)([^\s"'\:]+)(\s*\:)/g, '$1"$2"$3');
//if param values are wrapped in single quotes, replace with double quotes.
var paramStringWellFormed = paramStringWellFormed.replace(/(\:\s*)(')([^']+)(')/gm, '$1"$3"');
var paramStringWellFormed = paramStringWellFormed.replace(/(\:\s*)(')([^']+)(')/g, '$1"$3"');

var paramData = {};
var globalData = {};
Expand Down
Loading