2016-03-26 11:12:07 +00:00
|
|
|
"use strict";
|
2016-04-04 14:25:17 +00:00
|
|
|
/// <reference path="typings/main.d.ts" />
|
|
|
|
var plugins = require("./smartpath.plugins");
|
|
|
|
/**
|
|
|
|
* returns the type of the given path. Can be "url" or "local"
|
|
|
|
*/
|
2016-03-20 17:59:30 +00:00
|
|
|
exports.type = function (pathStringArg) {
|
|
|
|
var urlRegex = /http[s|\s]:\/\/.*/i;
|
|
|
|
if (urlRegex.exec(pathStringArg)) {
|
|
|
|
return "url";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return "local";
|
|
|
|
}
|
|
|
|
;
|
|
|
|
};
|
2016-04-04 14:25:17 +00:00
|
|
|
exports.home = function (pathArgument) {
|
|
|
|
if (pathArgument) {
|
|
|
|
return plugins.home.resolve(pathArgument);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return plugins.home();
|
|
|
|
}
|
|
|
|
};
|
2016-03-20 17:59:30 +00:00
|
|
|
|
2016-04-04 14:25:17 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0cGF0aC5nZXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBDQUEwQztBQUMxQyxJQUFPLE9BQU8sV0FBVyxxQkFBcUIsQ0FBQyxDQUFDO0FBRWhEOztHQUVHO0FBQ1EsWUFBSSxHQUFHLFVBQVMsYUFBb0I7SUFDM0MsSUFBSSxRQUFRLEdBQUcsb0JBQW9CLENBQUE7SUFDbkMsRUFBRSxDQUFBLENBQUMsUUFBUSxDQUFDLElBQUksQ0FBQyxhQUFhLENBQUMsQ0FBQyxDQUFBLENBQUM7UUFDN0IsTUFBTSxDQUFDLEtBQUssQ0FBQztJQUNqQixDQUFDO0lBQUMsSUFBSSxDQUFDLENBQUM7UUFDSixNQUFNLENBQUMsT0FBTyxDQUFDO0lBQ25CLENBQUM7SUFBQSxDQUFDO0FBQ04sQ0F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