From 66b92401bb8124c2596a08e518f297b4ed0b28bc Mon Sep 17 00:00:00 2001 From: sthag Date: Mon, 3 Nov 2025 19:12:47 +0100 Subject: [PATCH] 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 --- index.js | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 68ac0fd..b0180f5 100644 --- a/index.js +++ b/index.js @@ -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) }; })();