Improving performance

This commit is contained in:
Liyas Thomas
2019-11-28 20:41:52 +05:30
parent 2a81c2611b
commit b10a209daf
28 changed files with 1028 additions and 585 deletions

View File

@@ -5,16 +5,16 @@ export default function getEnvironmentVariablesFromScript(script) {
// for security and control purposes, this is the only way a pre-request script should modify variables.
let pw = {
environment: {
set: (key, value) => _variables[key] = value,
set: (key, value) => (_variables[key] = value)
},
env: {
set: (key, value) => _variables[key] = value,
},
set: (key, value) => (_variables[key] = value)
}
// globals that the script is allowed to have access to.
};
// run pre-request script within this function so that it has access to the pw object.
(new Function('pw', script))(pw);
new Function("pw", script)(pw);
return _variables;
}

View File

@@ -3,5 +3,5 @@ export default function parseTemplateString(string, variables) {
return string;
}
const searchTerm = /<<([^>]*)>>/g; // "<<myVariable>>"
return string.replace(searchTerm, (match, p1) => variables[p1] || '');
return string.replace(searchTerm, (match, p1) => variables[p1] || "");
}