diff options
Diffstat (limited to 'lib/utils.js')
-rw-r--r-- | lib/utils.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/utils.js b/lib/utils.js index c7d6932c..b0020ac8 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -97,3 +97,15 @@ var MAP = (function(){ function Splice(val) { this.v = val }; return MAP; })(); + +var BASE54_DIGITS = "etnrisouaflchpdvmgybwESxTNCkLAOM_DPHBjFIqRUzWXV$JKQGYZ0516372984"; + +function base54(num) { + var ret = "", base = 54; + do { + ret += BASE54_DIGITS.charAt(num % base); + num = Math.floor(num / base); + base = 64; + } while (num > 0); + return ret; +}; |