fix(core): update
This commit is contained in:
parent
76cfc8bec0
commit
48878c0b38
@ -25,7 +25,7 @@ tap.test('expect have the correct protocol', async () => {
|
|||||||
expect(testDomain.protocol).equal('https');
|
expect(testDomain.protocol).equal('https');
|
||||||
});
|
});
|
||||||
tap.test('testDomain2 expect be a basic domain', async () => {
|
tap.test('testDomain2 expect be a basic domain', async () => {
|
||||||
testDomain2 = new smartstring.Domain('bleu.de');
|
testDomain2 = new smartstring.Domain('testing.bleu.de');
|
||||||
console.log(testDomain2);
|
console.log(testDomain2);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -17,11 +17,15 @@ export class Domain {
|
|||||||
public nodeParsedUrl: plugins.url.UrlWithStringQuery;
|
public nodeParsedUrl: plugins.url.UrlWithStringQuery;
|
||||||
constructor(domainStringArg: string) {
|
constructor(domainStringArg: string) {
|
||||||
// lets do the node standard stuff first
|
// lets do the node standard stuff first
|
||||||
|
this.protocol = this._protocolRegex(domainStringArg);
|
||||||
|
if (!this.protocol) {
|
||||||
|
domainStringArg = `https://${domainStringArg}`
|
||||||
|
}
|
||||||
this.nodeParsedUrl = plugins.url.parse(domainStringArg);
|
this.nodeParsedUrl = plugins.url.parse(domainStringArg);
|
||||||
this.port = this.nodeParsedUrl.port;
|
this.port = this.nodeParsedUrl.port;
|
||||||
|
|
||||||
// lets do the rest after
|
// lets do the rest after
|
||||||
const regexMatches = this._domainRegex(domainStringArg.replace(this.nodeParsedUrl.path, ''));
|
const regexMatches = this._domainRegex(domainStringArg.replace(this.nodeParsedUrl.pathname, ''));
|
||||||
this.fullName = '';
|
this.fullName = '';
|
||||||
for (let i = 1; i <= 5; i++) {
|
for (let i = 1; i <= 5; i++) {
|
||||||
if (regexMatches[i - 1]) {
|
if (regexMatches[i - 1]) {
|
||||||
@ -36,7 +40,6 @@ export class Domain {
|
|||||||
this['level' + i.toString()] = undefined;
|
this['level' + i.toString()] = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.protocol = this._protocolRegex(domainStringArg);
|
|
||||||
this.zoneName = this.level2 + '.' + this.level1;
|
this.zoneName = this.level2 + '.' + this.level1;
|
||||||
|
|
||||||
// aliases
|
// aliases
|
||||||
|
Loading…
Reference in New Issue
Block a user