fix(core): Fix code formatting and indentation issues in smarturl.classes.smarturl.ts

This commit is contained in:
Philipp Kunz 2024-10-03 12:49:53 +02:00
parent 0ab0308eb1
commit c9b40c8725
3 changed files with 66 additions and 13 deletions

46
changelog.md Normal file
View File

@ -0,0 +1,46 @@
# Changelog
## 2024-10-03 - 3.0.8 - fix(core)
Fix code formatting and indentation issues in smarturl.classes.smarturl.ts
- Improved code readability by fixing indentation and ensuring consistent formatting.
## 2022-07-27 - 3.0.0 to 3.0.7 - Core Updates
Maintenance and enhancement updates across multiple minor versions.
- **3.0.0**: Core updated with foundational changes.
- **3.0.1**: Further core updates with minor fixes.
- **3.0.2**: Continued enhancements and core updates.
- **3.0.3**: Additional core updates.
- **3.0.4**: Continued improvements in core functions.
- **3.0.5**: Ongoing core enhancements and updates.
- **3.0.6**: Maintenance improvements and stable updates.
## 2022-07-27 - 2.0.2 to 3.0.0 - Major Transition
Introduction of significant changes to the core.
- **2.0.2**: Introduced breaking changes with a switch to ESM (ECMAScript Modules).
## 2021-05-02 - 1.0.8 to 2.0.2 - Stability Updates
Updates focused on core stability and functionality.
- **1.0.8**: Breaking core updates were introduced to stabilize the platform.
- **2.0.0**: Core was updated for greater efficiency.
- **2.0.1**: Minor core improvements and updates.
## 2021-04-12 - 1.0.3 to 1.0.8 - Core Maintenance
Multiple updates for improving the core functionality.
- Incremental updates from 1.0.3 through 1.0.7 enhancing core stability.
## 2020-03-27 - 1.0.1 to 1.0.2 - Initial Core Enhancements
Early updates focusing on core aspects.
- Introduction of minor core improvements and fixes.
## 2015-10-21 - 0.0.1 to 0.0.4 - Project Initialization
Initial setup and foundational updates for the project.
- **0.0.1**: Project initiation and Travis integration.
- **0.0.3**: Creation of initial test infrastructure.
- **0.0.4**: Basic project setup completed.

View File

@ -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.'
}

View File

@ -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}`;
}
}
}