File indexing completed on 2024-12-22 05:34:45

0001 window.appHelpers = (function(){
0002 
0003   function getEnv(domain){
0004 
0005     let env;
0006     let lastDotSplit = this.splitByLastDot(domain);
0007 
0008     if (lastDotSplit.indexOf('/') > -1){
0009       lastDotSplit = lastDotSplit.split('/')[0];
0010     }
0011 
0012     if (lastDotSplit === 'com' || lastDotSplit === 'org'){
0013       env = 'live';
0014     } else {
0015       env = 'test';
0016     }
0017     return env;
0018   }
0019 
0020   function splitByLastDot(text) {
0021     var index = text.lastIndexOf('.');
0022     return text.slice(index + 1);
0023   }
0024 
0025   return {
0026     getEnv,
0027     splitByLastDot
0028   }
0029 
0030 }());