2016-02-20 09:11:25 +00:00
|
|
|
/// <reference path="typings/main.d.ts" />
|
|
|
|
|
|
|
|
export var getEnvString = function():string {
|
|
|
|
if (typeof window !== "undefined") {
|
|
|
|
return "browser";
|
|
|
|
} else if (typeof process !== "undefined") {
|
|
|
|
return "node";
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export var getUserAgentString = function():string{
|
|
|
|
if(isBrowser()){
|
|
|
|
return navigator.userAgent;
|
|
|
|
} else {
|
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export var isNode = function():boolean {
|
2016-03-03 00:50:13 +00:00
|
|
|
return getEnvString() === "node"
|
2016-02-20 09:11:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export var getNodeVersion = function():string {
|
|
|
|
return process.version;
|
|
|
|
};
|
|
|
|
|
|
|
|
export var isBrowser = function():boolean {
|
|
|
|
return !isNode();
|
|
|
|
};
|
|
|
|
|
|
|
|
export var isCI = function(){
|
|
|
|
if(process.env.CI){
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2016-03-03 00:50:13 +00:00
|
|
|
export var isC9 = function(){
|
|
|
|
if (process.env.C9_HOSTNAME){
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-02-20 09:11:25 +00:00
|
|
|
export var isTravis = function(){
|
|
|
|
if(process.env.TRAVIS){
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
};
|