1
0
mirror of https://github.com/dzeiocom/libs.git synced 2025-04-23 19:32:14 +00:00

feat: Allow to remove the domain

Signed-off-by: Avior <f.bouillon@aptatio.com>
This commit is contained in:
Florian Bouillon 2022-10-18 12:47:47 +02:00
parent 31ae6d8418
commit d1d4169906
Signed by: Florian Bouillon
GPG Key ID: E05B3A94178D3A7C

View File

@ -167,19 +167,23 @@ export default class URLManager {
/**
* set the url domain name
* @param val the domain name
* @param val the domain name (if set to null it will remove the domain)
*/
public domain(val: string): this
public domain(val: string | null): this
/**
* Manipulate the url domain
* @param { string | undefined } val the url domain (Optionnal)
* @param { string | null | undefined } val the url domain (Optionnal)
* @return { string | this }
*/
public domain(val?: string) {
if (!val) {
public domain(val?: string | null) {
if (typeof val === 'undefined') {
return this._domain
}
if (!val) {
delete this._domain
return this
}
this._domain = val
return this
}