Add space after if

This commit is contained in:
pafcu 2017-11-16 12:19:56 +01:00 committed by GitHub
parent 2c1618bc10
commit 342378f48a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -102,13 +102,13 @@ export function _t(text, variables, tags) {
export function substitute(text, variables, tags) { export function substitute(text, variables, tags) {
const regexpMapping = {}; const regexpMapping = {};
if(variables !== undefined) { if (variables !== undefined) {
for (const variable in variables) { for (const variable in variables) {
regexpMapping[`%\\(${variable}\\)s`] = variables[variable]; regexpMapping[`%\\(${variable}\\)s`] = variables[variable];
} }
} }
if(tags !== undefined) { if (tags !== undefined) {
for (const tag in tags) { for (const tag in tags) {
regexpMapping[`(<${tag}>(.*?)<\\/${tag}>|<${tag}>|<${tag}\\s*\\/>)`] = tags[tag]; regexpMapping[`(<${tag}>(.*?)<\\/${tag}>|<${tag}>|<${tag}\\s*\\/>)`] = tags[tag];
} }
@ -163,7 +163,7 @@ export function replaceByRegexes(text, mapping) {
let replaced; let replaced;
// If substitution is a function, call it // If substitution is a function, call it
if(mapping[regexpString] instanceof Function) { if (mapping[regexpString] instanceof Function) {
replaced = mapping[regexpString].apply(null, capturedGroups); replaced = mapping[regexpString].apply(null, capturedGroups);
} else { } else {
replaced = mapping[regexpString]; replaced = mapping[regexpString];
@ -175,7 +175,7 @@ export function replaceByRegexes(text, mapping) {
output.push(replaced); output.push(replaced);
} }
if(typeof replaced === 'object') { if (typeof replaced === 'object') {
shouldWrapInSpan = true; shouldWrapInSpan = true;
} }
@ -185,7 +185,7 @@ export function replaceByRegexes(text, mapping) {
} }
} }
if(shouldWrapInSpan) { if (shouldWrapInSpan) {
return React.createElement('span', null, ...output); return React.createElement('span', null, ...output);
} else { } else {
return output.join(''); return output.join('');