Changing for...in loop for performance.
This commit is contained in:
parent
88414d61f7
commit
460de6e436
1 changed files with 8 additions and 11 deletions
|
|
@ -44,9 +44,8 @@ export default {
|
|||
parseQueryParms() {
|
||||
// Dump the query string parameters into an array. Remove casing on the key for easy compare.
|
||||
const queryStringParams = [];
|
||||
const params = Object.keys(this.$route.query);
|
||||
|
||||
params.forEach((param) => {
|
||||
Object.keys(this.$route.query).forEach((param) => {
|
||||
queryStringParams[param.toLowerCase()] = this.$route.query[param];
|
||||
});
|
||||
|
||||
|
|
@ -127,19 +126,17 @@ export default {
|
|||
try {
|
||||
const clientParams = JSON.parse(configParams);
|
||||
|
||||
// TODO: Modify to not iterate entire prototype chain
|
||||
for (const cparam in clientParams) {
|
||||
Object.keys(clientParams).forEach((cparam) => {
|
||||
const cname = clientParams[cparam].toLowerCase();
|
||||
|
||||
// TODO: Modify to not iterate entire prototype chain
|
||||
for (const qsparam in queryStringParams) {
|
||||
Object.keys(queryStringParams).forEach((qsparam) => {
|
||||
const qsname = qsparam.toLowerCase();
|
||||
|
||||
if (cname === qsname) {
|
||||
finalParams[cname] = queryStringParams[cname];
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
} catch (e) {
|
||||
window.console.error(`Error combining client parameters: ${e}`);
|
||||
}
|
||||
|
|
@ -148,8 +145,8 @@ export default {
|
|||
},
|
||||
populateStoreItemsFromParams(params) {
|
||||
// Populate store items from parameters.
|
||||
// TODO: Modify to not iterate entire prototype chain
|
||||
for (const param in params) {
|
||||
|
||||
Object.keys(params).forEach((param) => {
|
||||
const name = param.toLowerCase();
|
||||
const value = params[param];
|
||||
|
||||
|
|
@ -184,7 +181,7 @@ export default {
|
|||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue