1.0.5 • Published 4 years ago

split_n v1.0.5

Weekly downloads
2
License
MPL-2.0
Repository
github
Last release
4 years ago

Number.prototype.toString

let number prototype toString support radix 64

var SYMBOL, SYMBOL_LEN, toString;

SYMBOL = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_".split("");

SYMBOL_LEN = SYMBOL.length;

toString = Number.prototype.toString;

Number.prototype.toString = function(radix) {
  var conversion, decimal;
  if (radix && radix > 36 && radix <= SYMBOL_LEN) {
    decimal = this;
    conversion = "";
    while (decimal >= 1) {
      conversion = SYMBOL[decimal - (radix * Math.floor(decimal / radix))] + conversion;
      decimal = Math.floor(decimal / radix);
    }
    return conversion;
  } else {
    return toString.call(this, radix);
  }
};
1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago