fix(core): update
This commit is contained in:
parent
9d189d1b59
commit
7f3118c525
@ -56,4 +56,4 @@
|
||||
"browserslist": [
|
||||
"last 1 chrome versions"
|
||||
]
|
||||
}
|
||||
}
|
@ -29,4 +29,9 @@ tap.test('testDomain2 expect be a basic domain', async () => {
|
||||
console.log(testDomain2);
|
||||
});
|
||||
|
||||
tap.test('should parse complex domains', async () => {
|
||||
testDomain2 = new smartstring.Domain('https://sub1.sub2.lossless.com/some/path:5431');
|
||||
console.log(testDomain2);
|
||||
});
|
||||
|
||||
tap.start();
|
||||
|
@ -16,7 +16,12 @@ export class Domain {
|
||||
public port;
|
||||
public nodeParsedUrl: plugins.url.UrlWithStringQuery;
|
||||
constructor(domainStringArg: string) {
|
||||
const regexMatches = this._domainRegex(domainStringArg);
|
||||
// lets do the node standard stuff first
|
||||
this.nodeParsedUrl = plugins.url.parse(domainStringArg);
|
||||
this.port = this.nodeParsedUrl.port;
|
||||
|
||||
// lets do the rest after
|
||||
const regexMatches = this._domainRegex(domainStringArg.replace(this.nodeParsedUrl.path, ''));
|
||||
this.fullName = '';
|
||||
for (let i = 1; i <= 5; i++) {
|
||||
if (regexMatches[i - 1]) {
|
||||
@ -38,9 +43,6 @@ export class Domain {
|
||||
this.topLevel = this.level1;
|
||||
this.domainName = this.level2;
|
||||
this.subDomain = this.level3;
|
||||
|
||||
this.nodeParsedUrl = plugins.url.parse(domainStringArg);
|
||||
this.port = this.nodeParsedUrl.port;
|
||||
}
|
||||
|
||||
// helper functions
|
||||
|
@ -15,10 +15,4 @@ const normalizeNewline = require('normalize-newline');
|
||||
const randomatic = smartenvInstance.getSafeNodeModule('randomatic');
|
||||
const cryptoRandomString = smartenvInstance.getSafeNodeModule('crypto-random-string');
|
||||
|
||||
export {
|
||||
jsBase64,
|
||||
stripIndent,
|
||||
normalizeNewline,
|
||||
randomatic,
|
||||
cryptoRandomString
|
||||
}
|
||||
export { jsBase64, stripIndent, normalizeNewline, randomatic, cryptoRandomString };
|
||||
|
Loading…
Reference in New Issue
Block a user