Inline ASCII alphabet creation

This commit is contained in:
Florine W. Dekker 2019-07-08 18:31:26 +02:00
parent 53501eeef1
commit c1d5772383
Signed by: FWDekker
GPG Key ID: B1B567AF58D6EE0F
1 changed files with 1 additions and 11 deletions

View File

@ -81,16 +81,6 @@
}
}
class AsciiNumeralSystem extends NumeralSystem {
constructor() {
let alphabet = "";
for (let i = 0; i < 256; i++)
alphabet += String.fromCharCode(i);
super(256, alphabet);
}
}
class NumeralSystemInput {
constructor(name, numeralSystem) {
this.name = name;
@ -130,7 +120,7 @@
new NumeralSystemInput("Decimal", new NumeralSystem(10, "0123456789")),
new NumeralSystemInput("Hexadecimal", new NumeralSystem(16, "0123456789abcdef")),
new NumeralSystemInput("Base64", new NumeralSystem(64, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")),
new NumeralSystemInput("ASCII", new AsciiNumeralSystem()),
new NumeralSystemInput("ASCII", new NumeralSystem(256, new Array(256).fill(0).map((_, it) => String.fromCharCode(it)).join(""))),
];
const updateAllInputs = newValue => {