UNPKG

arrow-utils

Version:

arrow-utils library binds array and object methods.Complex Array and Object operations are made simple

1 lines 1.12 kB
var thisCtrl=this;exports.otpGen=function(r){try{for(var t="",e=0;e<r;e++)t+=Math.floor(9*Math.random());return t}catch(r){return}},exports.get_date_difference=function(r,t,e){try{var o,n=new Date(t)-new Date(r);if("ms"==e)return n;if("sec"==e)return(o=n/1e3)<1?0:o.toFixed(0);if("min"==e)return(o=n/1e3/60)<1?0:o.toFixed(0);if("hour"==e)return(o=n/1e3/60/60)<1?0:o.toFixed(0)}catch(r){return}},exports.Pipeline=function(r,t){try{var e;for(var o in t){var n=t[o];e=n(0==o?r:e)}return e}catch(r){return}},exports.encrypt=function(r){try{r=(r=r.split("")).reverse();var t="";for(var e of r){for(var o="",n=0;n<3;n++){o=o+""+(a=65,i=124,String.fromCharCode(Math.floor(Math.random()*(i-a)+a)))}e=Number.isInteger(Number(e))?e.charCodeAt(0)+20:e.charCodeAt(0)+6,t=t+(e=String.fromCharCode(e))+o}return t}catch(r){return}var a,i},exports.decrypt=function(r){try{for(var t=(r=r.split("")).length-4,e="";t>0;){o=(n=(o=r[t]).charCodeAt(0)-20)>=48&&n<=57?n:o.charCodeAt(0)-6,e+=o=String.fromCharCode(o),t-=4}var o,n;return o=(n=(o=r[0]).charCodeAt(0)-20)>=48&&n<=57?n:o.charCodeAt(0)-6,e+=o=String.fromCharCode(o)}catch(r){return}};