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) }; })();