now correctly parsing a Domain
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import SmartstringGit = require("./smartstring.git");
|
||||
import "typings-global"
|
||||
import SmartstringDocker = require("./smartstring.docker");
|
||||
import SmartstringTypescript = require("./smartstring.typescript");
|
||||
|
||||
export let git = SmartstringGit.git;
|
||||
export {Domain} from "./smartstring.domain";
|
||||
export {GitRepo} from "./smartstring.git";
|
||||
export let docker = SmartstringDocker;
|
||||
export let typescript = SmartstringTypescript;
|
@ -1,4 +1,4 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import "typings-global"
|
||||
import plugins = require("./smartstring.plugins");
|
||||
|
||||
/**
|
||||
|
40
ts/smartstring.domain.ts
Normal file
40
ts/smartstring.domain.ts
Normal file
@ -0,0 +1,40 @@
|
||||
import "typings-global"
|
||||
import plugins = require("./smartstring.plugins");
|
||||
|
||||
export class Domain {
|
||||
fullName:string;
|
||||
level1:string;
|
||||
level2:string;
|
||||
level3:string;
|
||||
level4:string;
|
||||
level5:string;
|
||||
protocol:string;
|
||||
//aliases
|
||||
topLevel:string;
|
||||
domainName;
|
||||
subDomain;
|
||||
constructor(domainStringArg:string){
|
||||
this.fullName = domainStringArg;
|
||||
let regexMatches = domainRegex(domainStringArg);
|
||||
this.level1 = regexMatches[0];
|
||||
this.level2 = regexMatches[1];
|
||||
this.level3 = regexMatches[2];
|
||||
this.level4 = regexMatches[3];
|
||||
this.level5 = regexMatches[4];
|
||||
// aliases
|
||||
this.topLevel = this.level1;
|
||||
this.domainName = this.level2;
|
||||
this.subDomain = this.level3;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let domainRegex = function(stringArg:string){
|
||||
let regexString = /([a-zA-Z0-9]*)\.{0,1}([a-zA-Z0-9]*)\.{0,1}([a-zA-Z0-9]*)\.{0,1}([a-zA-Z0-9]*)\.{0,1}([a-zA-Z0-9]*)\.{0,1}$/;
|
||||
let regexMatches = regexString.exec(stringArg);
|
||||
regexMatches.reverse();
|
||||
let regexMatchesFiltered = regexMatches.filter(function(stringArg:string){
|
||||
return(stringArg != "");
|
||||
});
|
||||
return regexMatchesFiltered;
|
||||
};
|
@ -1,10 +1,10 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import "typings-global"
|
||||
import plugins = require("./smartstring.plugins");
|
||||
|
||||
/* ---------------------------------------------- *
|
||||
* ------------------ classes ------------------- *
|
||||
* ---------------------------------------------- */
|
||||
export class gitRepo {
|
||||
export class GitRepo {
|
||||
host:string;
|
||||
user:string;
|
||||
repo:string;
|
||||
@ -50,12 +50,4 @@ let gitLink = function(hostArg:string, userArg:string, repoArg:string, tokenArg:
|
||||
break;
|
||||
}
|
||||
return returnString;
|
||||
};
|
||||
|
||||
/* ---------------------------------------------- *
|
||||
* ------------------ exports ------------------- *
|
||||
* ---------------------------------------------- */
|
||||
export let git = function(stringArg:string,tokenArg?:string){
|
||||
let localGitRepo = new gitRepo(stringArg,tokenArg);
|
||||
return localGitRepo;
|
||||
};
|
@ -1,3 +1,3 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import "typings-global"
|
||||
|
||||
export import beautylog = require("beautylog");
|
@ -1,3 +1,4 @@
|
||||
import "typings-global"
|
||||
import plugins = require("./smartstring.plugins");
|
||||
|
||||
export let regexReferencePath = /\/\/\/\s*<reference\s+path\s*=\s*["|'].*["|']\s*\/>\s*[\\n]?/
|
Reference in New Issue
Block a user