smartpath/ts/smartpath.get.ts

22 lines
526 B
TypeScript
Raw Normal View History

import "typings-global";
import * as plugins from "./smartpath.plugins";
2016-03-20 18:59:30 +01:00
2016-04-04 16:25:17 +02:00
/**
* returns the type of the given path. Can be "url" or "local"
*/
2016-03-20 18:59:30 +01: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 16:25:17 +02:00
};
export let home = function(pathArgument?:string){
if(pathArgument){
return plugins.home.resolve(pathArgument);
} else {
return plugins.home();
}
2016-03-20 18:59:30 +01:00
};