This commit is contained in:
n1474335 2022-07-08 15:04:09 +01:00
commit b71e3241be
2 changed files with 40 additions and 6 deletions

View file

@ -1,3 +1,5 @@
import Utils from "../Utils.mjs";
/**
* Base85 resources.
*
@ -32,13 +34,12 @@ export const ALPHABET_OPTIONS = [
* @returns {string}
*/
export function alphabetName(alphabet) {
alphabet = alphabet.replace(/'/g, "'");
alphabet = alphabet.replace(/"/g, """);
alphabet = alphabet.replace(/\\/g, "\");
alphabet = escape(alphabet);
let name;
ALPHABET_OPTIONS.forEach(function(a) {
if (escape(alphabet) === escape(a.value)) name = a.name;
const expanded = Utils.expandAlphRange(a.value).join("");
if (alphabet === escape(expanded)) name = a.name;
});
return name;