feat: Change how brand is build

- Add onerow ASCII definitions
- Add method to convert text to onerow style
- Use new function to build brand
- Remove hippie encapsulation
This commit is contained in:
sthag 2025-11-03 19:12:47 +01:00
parent 090514fc1b
commit 66b92401bb

View file

@ -1,9 +1,35 @@
const HIPPIE = (function () {
'use strict';
return {
hippie: {
brand: '|-| | |^ |^ | [- '
function mapStringToValues(input, values) {
if (typeof values === 'string') {
values = values.split(' ');
}
return input
.toUpperCase()
.split('')
.map(char => {
const charCode = char.charCodeAt(0);
let index;
if (charCode >= 65 && charCode <= 90) { // Check for A-Z
index = charCode - 65;
} else if (charCode >= 48 && charCode <= 57) { // Check for 0-9
index = 26 + (charCode - 48);
} else {
return char;
}
return values[index];
})
.join('');
}
return {
mapStringToValues: mapStringToValues,
onerowAlphabet: "/\\ ]3 ( |) [- /= (_, |-| | _T /< |_ |\\/| |\\| () |^ ()_ /? _\\~ ~|~ |_| \\/ \\/\\/ >< `/ ~/_ ",
onerowDigits: "(\\) \'| ^/_1 -} +| ;~ (o \"/ {} \"| ",
brand: mapStringToValues('h i p p i e', this.onerowAlphabet)
};
})();