Nodejs Utililty Methods String from Ascii85

List of utility methods to do String from Ascii85

Description

The list of methods to do String from Ascii85 are organized into topic(s).

Method

fromAscii85()
String.prototype.fromAscii85 = function() {
  var str = this.slice(2, -2).replace(/\s/g, ''), result = ''
  while (str.length) {
    if (str[0] == 'z') {
      result += '\u0000\u0000\u0000\u0000'
      str = str.substr(1)
    } else {
      let num = 0, j = 5, i = 4
      while (j--) {
...
fromAscii85()
String.prototype.fromAscii85 = function() {
  var ret = "";
  var str = this.replace(/\s+/g, "").replace("z", "!!!!!").slice(2, -2);
  for(var i=0; i<str.length; i+=5){
    var deficit = Math.max(0, 5+i-str.length);
    var nnn = 0;
    for(var j=0; j<5; j++){
      nnn = nnn*85 + (str.charCodeAt(i+j) || 117) - 33;
    var codes = [];
    for(var j=0; j<4; j++){
      codes.push(nnn%256);
      nnn = nnn/256 | 0;
    codes.reverse();
    var chunk = String.fromCharCode.apply(undefined, codes).slice(0, 4-deficit);
    ret+= chunk;
  return ret;
fromAscii85()
String.prototype.fromAscii85 = function() {
  var str = this.slice(2, -2).replace(/z/g, '!!!!!').replace(/\s/g, '');
  var decoded = '';
  for(var i = 0, len = str.length; i < len; i+=5) {
    var n = 0;
    var us = 0;
    for(var j = 4; j >= 0; j--) {
      var c = str[j+i] || (us++, 'u'),
          code = c.charCodeAt(0) - 33;
...
fromAscii85()
String.prototype.fromAscii85 = function() {
    console.log(this)
    let pad = 'u', addnum = 0, s = this.substring(2, this.length - 2).replace(/\s/g, ''), str = '', res = '';
    for (let i = 0; i < s.length; i++)
        str += s[i] === 'z' ? '!!!!!' : s[i];
    while (str.length % 5 !== 0)
        str += pad;
        addnum ++;
...