Commit c9db4820 authored by Ammar Alakkad's avatar Ammar Alakkad Committed by Vitaly Slobodin

Use map in sprintf instead of bracket notation

parent 7316c9a7
......@@ -15,8 +15,10 @@ export default (input, parameters, escapeParameters = true) => {
let output = input;
if (parameters) {
Object.keys(parameters).forEach((parameterName) => {
const parameterValue = parameters[parameterName];
const mappedParameters = new Map(Object.entries(parameters));
mappedParameters.forEach((key, parameterName) => {
const parameterValue = mappedParameters.get(parameterName);
const escapedParameterValue = escapeParameters ? escape(parameterValue) : parameterValue;
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