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:
parent
090514fc1b
commit
66b92401bb
1 changed files with 29 additions and 3 deletions
32
index.js
32
index.js
|
|
@ -1,9 +1,35 @@
|
||||||
const HIPPIE = (function () {
|
const HIPPIE = (function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
return {
|
function mapStringToValues(input, values) {
|
||||||
hippie: {
|
if (typeof values === 'string') {
|
||||||
brand: '|-| | |^ |^ | [- '
|
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)
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue