Merge pull request #115 from Safelite/feature/CSR-242

Keep static strings and replace dynamic ones
This commit is contained in:
Frank Rua 2021-12-22 11:05:59 -05:00 committed by GitHub
commit b3caf1cb58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -50,8 +50,15 @@ function mapStringToState(str) {
}
}
const stringWithReplacement = str.replace(match[0], storeState);
// If we still have values we need to substitute, call this function again.
if(stringWithReplacement.includes('{globalState:')) {
return mapStringToState(stringWithReplacement);
}
// Concatenate the string.
stringBuilder = `${stringBuilder} ${storeState}`;
stringBuilder = `${stringBuilder} ${stringWithReplacement}`;
}
return stringBuilder.trimStart();