smartpath/ts/smartpath.get.ts

22 lines
545 B
TypeScript
Raw Normal View History

2016-03-20 17:59:30 +00:00
/// <reference path="typings/main.d.ts" />
import plugins = require("./smartpath.plugins");
2016-04-04 14:25:17 +00:00
/**
* returns the type of the given path. Can be "url" or "local"
*/
2016-03-20 17:59:30 +00:00
export let type = function(pathStringArg:string):string {
let urlRegex = /http[s|\s]:\/\/.*/i
if(urlRegex.exec(pathStringArg)){
return "url";
} else {
return "local";
};
2016-04-04 14:25:17 +00:00
};
export let home = function(pathArgument?:string){
if(pathArgument){
return plugins.home.resolve(pathArgument);
} else {
return plugins.home();
}
2016-03-20 17:59:30 +00:00
};