fix(core): Fix code formatting and indentation issues in smarturl.classes.smarturl.ts
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
/**
|
||||
* autocreated commitinfo by @pushrocks/commitinfo
|
||||
* autocreated commitinfo by @push.rocks/commitinfo
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smarturl',
|
||||
version: '3.0.7',
|
||||
description: 'a url parsing lib'
|
||||
version: '3.0.8',
|
||||
description: 'A library for parsing URLs in a detailed and flexible way.'
|
||||
}
|
||||
|
@ -34,18 +34,18 @@ export class Smarturl implements IUrlObject {
|
||||
const searchParamPairs: {
|
||||
key: string;
|
||||
value: string;
|
||||
}[] = []
|
||||
}[] = [];
|
||||
|
||||
if (parsedUrlInstance.search) {
|
||||
parsedUrlInstance.search
|
||||
.replace('?', '')
|
||||
.split('&')
|
||||
.map((searchParamPair) => {
|
||||
searchParamPairs.push({
|
||||
key: searchParamPair.split('=')[0],
|
||||
value: searchParamPair.split('=')[1],
|
||||
.replace('?', '')
|
||||
.split('&')
|
||||
.map((searchParamPair) => {
|
||||
searchParamPairs.push({
|
||||
key: searchParamPair.split('=')[0],
|
||||
value: searchParamPair.split('=')[1],
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
for (const searchParamPair of searchParamPairs) {
|
||||
@ -100,6 +100,7 @@ export class Smarturl implements IUrlObject {
|
||||
Object.assign(returnSmarturl, parsedUrl);
|
||||
return returnSmarturl;
|
||||
}
|
||||
|
||||
public static createFromParsedUrl(parsedUrlArg: IUrlObject) {
|
||||
const returnSmarturl = new Smarturl();
|
||||
Object.assign(returnSmarturl, parsedUrlArg);
|
||||
@ -125,6 +126,13 @@ export class Smarturl implements IUrlObject {
|
||||
this.searchParams = {};
|
||||
}
|
||||
|
||||
clone(): Smarturl {
|
||||
const clonedInstance = new Smarturl();
|
||||
Object.assign(clonedInstance, this);
|
||||
clonedInstance.searchParams = { ...this.searchParams };
|
||||
return clonedInstance;
|
||||
}
|
||||
|
||||
toString() {
|
||||
let userpart = ``;
|
||||
if (this.username && !this.password) {
|
||||
@ -134,7 +142,6 @@ export class Smarturl implements IUrlObject {
|
||||
userpart = `${this.username}:${this.password}@`;
|
||||
}
|
||||
|
||||
|
||||
return `${this.protocol}//${userpart}${this.hostname}:${this.port}${this.path}`;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user