Comparing version 1.0.14 to 1.0.15
@@ -6,2 +6,13 @@ # Change Log | ||
## [1.0.14](https://github.com/bluelovers/lazy-url/compare/lazy-url@1.0.13...lazy-url@1.0.14) (2021-08-11) | ||
### 📦 Code Refactoring | ||
* update error ([1faa913](https://github.com/bluelovers/lazy-url/commit/1faa91392e2fc910990f89f65030b87d9ee2fce1)) | ||
## [1.0.13](https://github.com/bluelovers/lazy-url/compare/lazy-url@1.0.12...lazy-url@1.0.13) (2021-08-11) | ||
@@ -8,0 +19,0 @@ |
@@ -29,3 +29,3 @@ /** | ||
*/ | ||
toRealString(): string; | ||
toRealString(ignoreInvalid?: boolean): string; | ||
toString(): string; | ||
@@ -41,2 +41,4 @@ get hostname(): string; | ||
set protocol(value: string); | ||
get auth(): string; | ||
set auth(value: string); | ||
/** | ||
@@ -43,0 +45,0 @@ * @alias protocol |
@@ -84,3 +84,3 @@ "use strict"; | ||
*/ | ||
toRealString() { | ||
toRealString(ignoreInvalid) { | ||
let ks = this.fakeEntries(); | ||
@@ -96,3 +96,9 @@ if (ks.length) { | ||
if (u.host === '') { | ||
if (u.username !== '' || u.password !== '' || u.port !== '' || u.protocol !== '') { | ||
if (ignoreInvalid) { | ||
u.set('username', ''); | ||
u.set('password', ''); | ||
u.set('port', ''); | ||
u.set('protocol', ''); | ||
} | ||
else if (u.username !== '' || u.password !== '' || u.port !== '' || u.protocol !== '') { | ||
//throw new TypeError(`Invalid URL ${u}`) | ||
@@ -234,2 +240,16 @@ throw _wrapError(new TypeError(`Invalid URL`), u); | ||
} | ||
get auth() { | ||
var _a, _b; | ||
if ((_a = this.username) === null || _a === void 0 ? void 0 : _a.length) { | ||
return `${this.username}:${(_b = this.password) !== null && _b !== void 0 ? _b : ''}`; | ||
} | ||
return ''; | ||
} | ||
set auth(value) { | ||
this.username = ''; | ||
this.password = ''; | ||
let ls = value.split(':'); | ||
this.username = ls.shift(); | ||
this.password = ls.join(':'); | ||
} | ||
/* | ||
@@ -236,0 +256,0 @@ get search() |
{ | ||
"name": "lazy-url", | ||
"version": "1.0.14", | ||
"version": "1.0.15", | ||
"description": "a more easy use URL", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53610
648