Browse Source

Remove unintended case sensitivity

master
F.W. Dekker 2 years ago
parent
commit
c18cce36af
Signed by: FWDekker GPG Key ID: B1B567AF58D6EE0F
  1. 13
      index.html

13
index.html

@ -62,9 +62,10 @@
integrity="sha256-es+ex6Oj344uak+VnCPyaHY2nzQkqhr7ByWVQgdjATA=" crossorigin="anonymous"></script>
<script>
class NumeralSystem {
constructor(base, alphabet) {
constructor(base, alphabet, caseSensitive) {
this.base = base;
this.alphabet = alphabet;
this.caseSensitive = caseSensitive;
}
@ -73,11 +74,11 @@
}
baseToDecimal(baseString) {
return bigInt(baseString, this.base, this.alphabet);
return bigInt(baseString, this.base, this.alphabet, this.caseSensitive);
}
filterBaseString(baseString) {
return baseString.toLowerCase().replace(new RegExp("[^" + this.alphabet + "]"), "");
return baseString.replace(new RegExp("[^" + this.alphabet + "]"), "");
}
}
@ -118,9 +119,9 @@
new NumeralSystemInput("Binary", new NumeralSystem(2, "01")),
new NumeralSystemInput("Octal", new NumeralSystem(8, "01234567")),
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 NumeralSystem(256, new Array(256).fill(0).map((_, it) => String.fromCharCode(it)).join(""))),
new NumeralSystemInput("Hexadecimal", new NumeralSystem(16, "0123456789abcdef", caseSensitive = false)),
new NumeralSystemInput("Base64", new NumeralSystem(64, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", caseSensitive = true)),
new NumeralSystemInput("ASCII", new NumeralSystem(256, new Array(256).fill(0).map((_, it) => String.fromCharCode(it)).join(""), caseSensitive = true)),
];
const updateAllInputs = newValue => {

Loading…
Cancel
Save