Merge branch 'winh-fix-sprintf-eslint' into 'master'
Fix linting errors in sprintf See merge request gitlab-org/gitlab-ce!14664
This commit is contained in:
commit
900a19edfc
|
@ -12,15 +12,15 @@ import _ from 'underscore';
|
||||||
@see https://gitlab.com/gitlab-org/gitlab-ce/issues/37992
|
@see https://gitlab.com/gitlab-org/gitlab-ce/issues/37992
|
||||||
**/
|
**/
|
||||||
export default (input, parameters, escapeParameters = true) => {
|
export default (input, parameters, escapeParameters = true) => {
|
||||||
let output = input;
|
let output = input;
|
||||||
|
|
||||||
if (parameters) {
|
if (parameters) {
|
||||||
Object.keys(parameters).forEach((parameterName) => {
|
Object.keys(parameters).forEach((parameterName) => {
|
||||||
const parameterValue = parameters[parameterName];
|
const parameterValue = parameters[parameterName];
|
||||||
const escapedParameterValue = escapeParameters ? _.escape(parameterValue) : parameterValue;
|
const escapedParameterValue = escapeParameters ? _.escape(parameterValue) : parameterValue;
|
||||||
output = output.replace(new RegExp(`%{${parameterName}}`, 'g'), escapedParameterValue);
|
output = output.replace(new RegExp(`%{${parameterName}}`, 'g'), escapedParameterValue);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
};
|
||||||
|
|
Loading…
Reference in New Issue