Commit 9d990969 authored by Mark Florian's avatar Mark Florian

Merge branch 'lm-replace-underscore-lodash-escape' into 'master'

Replaces underscore with lodash for escape

See merge request gitlab-org/gitlab!25579
parents f1dd8af7 e343132a
import _ from 'underscore'; import { escape } from 'lodash';
/** /**
Very limited implementation of sprintf supporting only named parameters. Very limited implementation of sprintf supporting only named parameters.
...@@ -17,7 +17,7 @@ export default (input, parameters, escapeParameters = true) => { ...@@ -17,7 +17,7 @@ export default (input, parameters, escapeParameters = true) => {
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);
}); });
} }
......
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