[typescript-rxjs] Update servers.mustache (#9449)

* Update servers.mustache

add hasOwnProperty checking; use const instead of var

* use 4 spaces instead of tabs
This commit is contained in:
rainmanhhh 2023-08-11 10:30:40 +08:00 committed by GitHub
parent cc496ff2eb
commit a33c353a26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,8 +31,10 @@ export class ServerConfiguration<T extends { [key: string]: string }> {
public getUrl(): string {
let replacedUrl = this.url;
for (const key in this.variableConfiguration) {
var re = new RegExp("{" + key + "}","g");
replacedUrl = replacedUrl.replace(re, this.variableConfiguration[key]);
if (this.variableConfiguration.hasOwnProperty(key)) {
const re = new RegExp("{" + key + "}","g");
replacedUrl = replacedUrl.replace(re, this.variableConfiguration[key]);
}
}
return replacedUrl;
}