Comparing version 1.0.15 to 1.0.16
@@ -6,2 +6,18 @@ # Change Log | ||
## [1.0.15](https://github.com/bluelovers/lazy-url/compare/lazy-url@1.0.14...lazy-url@1.0.15) (2021-08-11) | ||
### ✨ Features | ||
* support auth ([8e537fe](https://github.com/bluelovers/lazy-url/commit/8e537fe258660844f5b22d2abd5306ef91feb0ea)) | ||
### 🚨 Tests | ||
* update test ([e530690](https://github.com/bluelovers/lazy-url/commit/e53069062dfde7e9b34fc2326370c36887e336e5)) | ||
## [1.0.14](https://github.com/bluelovers/lazy-url/compare/lazy-url@1.0.13...lazy-url@1.0.14) (2021-08-11) | ||
@@ -8,0 +24,0 @@ |
/** | ||
* Created by user on 2019/6/6. | ||
*/ | ||
import { StringifyQuery, URLPart } from 'url-parse'; | ||
export declare type IURLLike = string | URL | IURLObjectLike; | ||
@@ -29,3 +30,6 @@ export declare const SYM_URL: unique symbol; | ||
*/ | ||
toRealString(ignoreInvalid?: boolean): string; | ||
toRealString(options?: { | ||
ignoreInvalid?: boolean; | ||
stringify?: StringifyQuery; | ||
}): string; | ||
toString(): string; | ||
@@ -81,2 +85,4 @@ get hostname(): string; | ||
createURLSearchParams(init?: string[][] | Record<string, string> | string | URLSearchParams | URL): URLSearchParams; | ||
set<K extends Extract<URLPart, keyof LazyURL>>(part: K, value: LazyURL[K]): void; | ||
get<K extends Extract<URLPart, keyof LazyURL>>(part: K): LazyURL[K]; | ||
} | ||
@@ -83,0 +89,0 @@ export declare type IEntries = (["hash" | "host" | "hostname" | "href" | "password" | "pathname" | "port" | "protocol" | "search" | "username", string] | ["searchParams", URLSearchParams])[]; |
@@ -84,3 +84,3 @@ "use strict"; | ||
*/ | ||
toRealString(ignoreInvalid) { | ||
toRealString(options) { | ||
let ks = this.fakeEntries(); | ||
@@ -96,3 +96,3 @@ if (ks.length) { | ||
if (u.host === '') { | ||
if (ignoreInvalid) { | ||
if (options === null || options === void 0 ? void 0 : options.ignoreInvalid) { | ||
u.set('username', ''); | ||
@@ -108,3 +108,3 @@ u.set('password', ''); | ||
} | ||
let s = u.toString(); | ||
let s = u.toString(options === null || options === void 0 ? void 0 : options.stringify); | ||
if (u.protocol === '' && u.host === '') { | ||
@@ -373,2 +373,8 @@ s = s.replace(/^\/\//, ''); | ||
} | ||
set(part, value) { | ||
this[part] = value; | ||
} | ||
get(part) { | ||
return this[part]; | ||
} | ||
} | ||
@@ -375,0 +381,0 @@ exports.LazyURL = LazyURL; |
{ | ||
"name": "lazy-url", | ||
"version": "1.0.15", | ||
"version": "1.0.16", | ||
"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
54965
660