Commit a30fbbdd authored by Clement Ho's avatar Clement Ho

Reduce over-verboseness

parent f0935c4d
...@@ -47,13 +47,11 @@ ...@@ -47,13 +47,11 @@
const sanitizedKey = key.slice(0, key.indexOf('_')); const sanitizedKey = key.slice(0, key.indexOf('_'));
const valueHasSpace = sanitizedValue.indexOf(' ') !== -1; const valueHasSpace = sanitizedValue.indexOf(' ') !== -1;
const symbol = match.symbol; const symbol = match.symbol;
let quotationsToUse;
const preferredQuotations = '"';
let quotationsToUse = preferredQuotations;
if (valueHasSpace) { if (valueHasSpace) {
// Prefer ", but use ' if required // Prefer ", but use ' if required
quotationsToUse = sanitizedValue.indexOf(preferredQuotations) === -1 ? preferredQuotations : '\''; quotationsToUse = sanitizedValue.indexOf('"') === -1 ? '"' : '\'';
} }
inputValue += valueHasSpace ? `${sanitizedKey}:${symbol}${quotationsToUse}${sanitizedValue}${quotationsToUse}` : `${sanitizedKey}:${symbol}${sanitizedValue}`; inputValue += valueHasSpace ? `${sanitizedKey}:${symbol}${quotationsToUse}${sanitizedValue}${quotationsToUse}` : `${sanitizedKey}:${symbol}${sanitizedValue}`;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment