Skip to content

Commit

Permalink
Merge pull request #53 from UmamiAppearance/uuencode_original_fixes
Browse files Browse the repository at this point in the history
Uuencode original fixes
  • Loading branch information
UmamiAppearance committed May 21, 2023
2 parents a206d34 + 44e0e0d commit dca61c5
Show file tree
Hide file tree
Showing 13 changed files with 91 additions and 38 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ The **Ex** in the name stands for **Ex**ponent (of n) or - as read out loud - fo
<li>base64</li>
<li>base64_urlsafe</li>
<li>uuencode</li>
<li>uuencode_original</li>
<li>xxencode</li>
<li>base85_adobe</li>
<li>base85_ascii</li>
Expand Down
19 changes: 14 additions & 5 deletions cjs/base-ex.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2055,13 +2055,14 @@ class Base64 extends BaseTemplate {
* BaseEx UUencode Converter.
* ------------------------
*
* This is a base64 converter. Various input can be
* converted to a base64 string or a base64 string
* This is a UUencoder/UUdecoder. Various input can be
* converted to a UUencoded string or a UUencoded string
* can be decoded into various formats.
*
* Available charsets are:
* - default
* - urlsafe
* - original
* - xx
*/
class UUencode extends BaseTemplate {

Expand Down Expand Up @@ -2170,7 +2171,7 @@ class UUencode extends BaseTemplate {
const format = ({ input, settings }) => {

const charset = this.charsets[settings.version];
const lines = input.trim().split("\n");
const lines = input.trim().split(/\r?\n/);
const inArray = [];

if ((/^begin/i).test(lines.at(0))) {
Expand All @@ -2187,10 +2188,17 @@ class UUencode extends BaseTemplate {

inArray.push(...lArray);

if (byteCount !== 45) {
if (byteCount !== 45) {
padChars = this.converter.padChars(lArray.length) - byteCount;
break;
}

// fix probably missing spaces for original charset
else if (lArray.length !== 60 && settings.version === "original") {
while (inArray.length % 60) {
inArray.push(" ");
}
}
}

return inArray.join("");
Expand Down Expand Up @@ -3896,6 +3904,7 @@ class BaseEx {
this.base64 = new Base64("default", outputType);
this.base64_urlsafe = new Base64("urlsafe", outputType);
this.uuencode = new UUencode("default", outputType);
this.uuencode_original = new UUencode("original", outputType);
this.xxencode = new UUencode("xx", outputType);
this.base85_adobe = new Base85("adobe", outputType);
this.base85_ascii = new Base85("ascii85", outputType);
Expand Down
2 changes: 1 addition & 1 deletion cjs/base-ex.cjs.map

Large diffs are not rendered by default.

19 changes: 14 additions & 5 deletions dist/base-ex.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2053,13 +2053,14 @@ class Base64 extends BaseTemplate {
* BaseEx UUencode Converter.
* ------------------------
*
* This is a base64 converter. Various input can be
* converted to a base64 string or a base64 string
* This is a UUencoder/UUdecoder. Various input can be
* converted to a UUencoded string or a UUencoded string
* can be decoded into various formats.
*
* Available charsets are:
* - default
* - urlsafe
* - original
* - xx
*/
class UUencode extends BaseTemplate {

Expand Down Expand Up @@ -2168,7 +2169,7 @@ class UUencode extends BaseTemplate {
const format = ({ input, settings }) => {

const charset = this.charsets[settings.version];
const lines = input.trim().split("\n");
const lines = input.trim().split(/\r?\n/);
const inArray = [];

if ((/^begin/i).test(lines.at(0))) {
Expand All @@ -2185,10 +2186,17 @@ class UUencode extends BaseTemplate {

inArray.push(...lArray);

if (byteCount !== 45) {
if (byteCount !== 45) {
padChars = this.converter.padChars(lArray.length) - byteCount;
break;
}

// fix probably missing spaces for original charset
else if (lArray.length !== 60 && settings.version === "original") {
while (inArray.length % 60) {
inArray.push(" ");
}
}
}

return inArray.join("");
Expand Down Expand Up @@ -3894,6 +3902,7 @@ class BaseEx {
this.base64 = new Base64("default", outputType);
this.base64_urlsafe = new Base64("urlsafe", outputType);
this.uuencode = new UUencode("default", outputType);
this.uuencode_original = new UUencode("original", outputType);
this.xxencode = new UUencode("xx", outputType);
this.base85_adobe = new Base85("adobe", outputType);
this.base85_ascii = new Base85("ascii85", outputType);
Expand Down
4 changes: 2 additions & 2 deletions dist/base-ex.esm.min.js

Large diffs are not rendered by default.

19 changes: 14 additions & 5 deletions dist/base-ex.iife.js
Original file line number Diff line number Diff line change
Expand Up @@ -2056,13 +2056,14 @@ var BaseEx = (function (exports) {
* BaseEx UUencode Converter.
* ------------------------
*
* This is a base64 converter. Various input can be
* converted to a base64 string or a base64 string
* This is a UUencoder/UUdecoder. Various input can be
* converted to a UUencoded string or a UUencoded string
* can be decoded into various formats.
*
* Available charsets are:
* - default
* - urlsafe
* - original
* - xx
*/
class UUencode extends BaseTemplate {

Expand Down Expand Up @@ -2171,7 +2172,7 @@ var BaseEx = (function (exports) {
const format = ({ input, settings }) => {

const charset = this.charsets[settings.version];
const lines = input.trim().split("\n");
const lines = input.trim().split(/\r?\n/);
const inArray = [];

if ((/^begin/i).test(lines.at(0))) {
Expand All @@ -2188,10 +2189,17 @@ var BaseEx = (function (exports) {

inArray.push(...lArray);

if (byteCount !== 45) {
if (byteCount !== 45) {
padChars = this.converter.padChars(lArray.length) - byteCount;
break;
}

// fix probably missing spaces for original charset
else if (lArray.length !== 60 && settings.version === "original") {
while (inArray.length % 60) {
inArray.push(" ");
}
}
}

return inArray.join("");
Expand Down Expand Up @@ -3897,6 +3905,7 @@ var BaseEx = (function (exports) {
this.base64 = new Base64("default", outputType);
this.base64_urlsafe = new Base64("urlsafe", outputType);
this.uuencode = new UUencode("default", outputType);
this.uuencode_original = new UUencode("original", outputType);
this.xxencode = new UUencode("xx", outputType);
this.base85_adobe = new Base85("adobe", outputType);
this.base85_ascii = new Base85("ascii85", outputType);
Expand Down
4 changes: 2 additions & 2 deletions dist/base-ex.iife.min.js

Large diffs are not rendered by default.

18 changes: 13 additions & 5 deletions dist/converters/UUencode/uuencode.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -1461,13 +1461,14 @@ class BaseTemplate {
* BaseEx UUencode Converter.
* ------------------------
*
* This is a base64 converter. Various input can be
* converted to a base64 string or a base64 string
* This is a UUencoder/UUdecoder. Various input can be
* converted to a UUencoded string or a UUencoded string
* can be decoded into various formats.
*
* Available charsets are:
* - default
* - urlsafe
* - original
* - xx
*/
class UUencode extends BaseTemplate {

Expand Down Expand Up @@ -1576,7 +1577,7 @@ class UUencode extends BaseTemplate {
const format = ({ input, settings }) => {

const charset = this.charsets[settings.version];
const lines = input.trim().split("\n");
const lines = input.trim().split(/\r?\n/);
const inArray = [];

if ((/^begin/i).test(lines.at(0))) {
Expand All @@ -1593,10 +1594,17 @@ class UUencode extends BaseTemplate {

inArray.push(...lArray);

if (byteCount !== 45) {
if (byteCount !== 45) {
padChars = this.converter.padChars(lArray.length) - byteCount;
break;
}

// fix probably missing spaces for original charset
else if (lArray.length !== 60 && settings.version === "original") {
while (inArray.length % 60) {
inArray.push(" ");
}
}
}

return inArray.join("");
Expand Down
2 changes: 1 addition & 1 deletion dist/converters/UUencode/uuencode.esm.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 13 additions & 5 deletions dist/converters/UUencode/uuencode.iife.js
Original file line number Diff line number Diff line change
Expand Up @@ -1464,13 +1464,14 @@ var UUencode = (function () {
* BaseEx UUencode Converter.
* ------------------------
*
* This is a base64 converter. Various input can be
* converted to a base64 string or a base64 string
* This is a UUencoder/UUdecoder. Various input can be
* converted to a UUencoded string or a UUencoded string
* can be decoded into various formats.
*
* Available charsets are:
* - default
* - urlsafe
* - original
* - xx
*/
class UUencode extends BaseTemplate {

Expand Down Expand Up @@ -1579,7 +1580,7 @@ var UUencode = (function () {
const format = ({ input, settings }) => {

const charset = this.charsets[settings.version];
const lines = input.trim().split("\n");
const lines = input.trim().split(/\r?\n/);
const inArray = [];

if ((/^begin/i).test(lines.at(0))) {
Expand All @@ -1596,10 +1597,17 @@ var UUencode = (function () {

inArray.push(...lArray);

if (byteCount !== 45) {
if (byteCount !== 45) {
padChars = this.converter.padChars(lArray.length) - byteCount;
break;
}

// fix probably missing spaces for original charset
else if (lArray.length !== 60 && settings.version === "original") {
while (inArray.length % 60) {
inArray.push(" ");
}
}
}

return inArray.join("");
Expand Down
2 changes: 1 addition & 1 deletion dist/converters/UUencode/uuencode.iife.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/base-ex.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class BaseEx {
this.base64 = new Base64("default", outputType);
this.base64_urlsafe = new Base64("urlsafe", outputType);
this.uuencode = new UUencode("default", outputType);
this.uuencode_original = new UUencode("original", outputType);
this.xxencode = new UUencode("xx", outputType);
this.base85_adobe = new Base85("adobe", outputType);
this.base85_ascii = new Base85("ascii85", outputType);
Expand Down
Loading

0 comments on commit dca61c5

Please sign in to comment.