[
  {
    "path": ".gitignore",
    "content": ".DS_Store"
  },
  {
    "path": "LICENSE",
    "content": "Copyright (C) 2019 Robert Gerlach\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
  },
  {
    "path": "README.md",
    "content": "# Lunicode.js\n\nA JavaScript Library to convert text in various useless but amusing ways.  \n&#x2d9;&#x73;&#x28e;&#x250;&#x28d; &#x253;&#x75;&#x131;&#x73;&#x6e;&#x26f;&#x250; &#x287;&#x6e;&#x71; &#x73;&#x73;&#x1dd;&#x6c;&#x1dd;&#x73;&#x6e; &#x73;&#x6e;&#x6f;&#x131;&#x279;&#x250;&#x28c; &#x75;&#x131; &#x287;&#x78;&#x1dd;&#x287; &#x287;&#x279;&#x1dd;&#x28c;&#x75;&#x6f;&#x254; &#x6f;&#x287; &#x28e;&#x279;&#x250;&#x279;&#x71;&#x131;&#x2e5; &#x287;&#x64;&#x131;&#x279;&#x254;&#x53;&#x250;&#x28c;&#x250;&#x17f; &#x2200;\n\nExtracted from [lunicode.com](http://lunicode.com).\n\nIf it looks weird and boxy, you need a Unicode font:\n\n<ul>\n\t<li><a target=\"_blank\" href=\"http://dejavu-fonts.org/wiki/Main_Page\">DejaVu Sans</a></li>\n\t<li><a target=\"_blank\" href=\"http://www.fonts2u.com/code2000.font\">Code2000</a></li>\n\t<li><a target=\"_blank\" href=\"http://www.lgm.cl/trabajos/unifont/index.en.html\">GNU Unifont</a></li>\n\t<li><a target=\"_blank\" href=\"http://web.nickshanks.com/fonts/kannada/\">Kedage</a></li>\n</ul>\n\nUse it like this:\n\n    // Get the Lunicode object, initializing the effects\n    var luni = new Lunicode();\n    \n    // Or if you installed lunicode via npm:\n    var luni = require(\"Lunicode\");\n    \n\t// Encode text. Use one of the effects shown below. Here it's \"flip\"\n    var encodedText = luni.tools.flip.encode(\"Hello World\");  // plɹoM ollǝH\n    \n    // Decode text back to plain ASCII (or reverse encoding)\n    var plainText = luni.tools.mirror.decode(\"ƚxɘT ɿoɿɿiM\");  // Mirror Text\n    \n    // Creepify has a few options. Set them before encoding:\n    luni.tools.creepify.options.top = true; \t// add diacritics on top. Default: true \n    luni.tools.creepify.options.middle = true;\t// add diacritics in the middle. Default: true \n    luni.tools.creepify.options.bottom = true;\t// add diacritics on the bottom. Default: true\n    luni.tools.creepify.options.maxHeight = 15; // How many diacritic marks shall we put on top/bottom? Default: 15\n    luni.tools.creepify.options.randomization = 100; // 0-100%. maxHeight 100 and randomization 20%: the height goes from 80 to 100. randomization 70%: height goes from 30 to 100. Default: 100\n    \n    // To convert Unicode text to HTML, use luni.getHTML(text);\n    // Also converts \\n to <br>\\n and multiple spaces to &nbsp; &nbsp; &nbsp; ...\n    var html = luni.getHTML(\"ǝpoɔıu∩̤\"); // &#x1dd;&#x70;&#x6f;&#x254;&#x131;&#x75;&#x2229;&#x324;\n\n\n# Effects\n\n\n## flip\n\nFlips/Rotates text, including numbers (12345) and some special characters: äöü éáú ÄÖÜ ß ô\n\no̮ ᙠ ∩̤O̤∀̤ n̗ɐ̗ǝ̗ n̤o̤ɐ̤ :sɹǝʇɔɐɹɐɥɔ lɐıɔǝds ǝɯos puɐ (ގㄣƐᄅ⇂) sɹǝqɯnu ɓuıpnlɔuı 'ʇxǝʇ sǝʇɐʇoᴚ/sdılℲ\n\n## mirror\n\nMirrors text horizontally. äöü ß èàù. Käseküchlein.\n\n.ᴎiɘ|ʜɔüʞɘꙅɒ̈⋊ .úɒ́ɘ́ ᙠ üöɒ̈ .ʏ||ɒƚᴎoƹiɿoʜ ƚxɘƚ ꙅɿoɿɿiM\n\n## creepify\n\nAdds  \n\tdiacritics\n\t\n\nĄ̵̛͎̗͎̯͕̺̭͍̩͐̄̄͗̿͛̔̀́̋̄͜d̷̨͉͇̞̲̥͈̝̺̘̪̥̟͚̘̫̑̋̎͜͜ḑ̵̡̛̤̱̣̼̞̥̻͕͗̔̀̐́̆̐̓͌̊͛̐̉̚͝s̴̯̤̓̐͒̓̉͆̿̔̚͝\n\ṱ̶̼͂̃d̴̡̰̯̲̣̘͉͉̯̣̥͋̈́̊̏̓̀͒̚i̷̮̭͋̈́̋͋̉͊̄̓͂̕a̶̳̣̲̓̊͋c̵̡̛̗͕̖̻͇̪͆̌͒͊͛͌̽̐̇̇̀͊̂̈͒̚͜͠ṙ̷̡̹̱̜̖̦̭ĩ̵͍̪̘͚̗̰͓̙͛͆̽̾͒̏̀͗̊̊́̍̉͒̊ţ̶̙͙̙͉̱́̀̈́̿͛͊̎̓̉̕̕͜͝i̵̛̞̭̭̮̱̬̯̙̖̺̼͑͛ͅć̶̢̡̫̻̪̩̤̱̠̰̹̙͒́̀͐͐̚̚͘͝͝ṩ̸̢̧̠͖̩͚̯̳͓̻̪̻̞\n\n## bubbles\n\nBubbles around normal characters. Uses combining characters for everything else.\n\nⒷⓤⓑⓑⓛⓔⓢ ⓐⓡⓞⓤⓝⓓ ⓝⓞⓡⓜⓐⓛ ⓒⓗⓐⓡⓐⓒⓣⓔⓡⓢ    .⃝ Ⓤⓢⓔⓢ ⓒⓞⓜⓑⓘⓝⓘⓝⓖ ⓒⓗⓐⓡⓐⓒⓣⓔⓡⓢ ⓕⓞⓡ ⓔⓥⓔⓡⓨⓣⓗⓘⓝⓖ ⓔⓛⓢⓔ    .⃝\n\n## squares\n\nSquares, via combining characters.\n\nS⃞    q⃞    u⃞    a⃞    r⃞    e⃞    s⃞    ,⃞     v⃞    i⃞    a⃞     c⃞    o⃞    m⃞    b⃞    i⃞    n⃞    i⃞    n⃞    g⃞     c⃞    h⃞    a⃞    r⃞    a⃞    c⃞    t⃞    e⃞    r⃞    s⃞    .⃞\n\n## roundsquares\n\nRound squares, via combining characters.\n\nR⃣   o⃣   u⃣   n⃣   d⃣    s⃣   q⃣   u⃣   a⃣   r⃣   e⃣   s⃣   ,⃣    v⃣   i⃣   a⃣    c⃣   o⃣   m⃣   b⃣   i⃣   n⃣   i⃣   n⃣   g⃣    c⃣   h⃣   a⃣   r⃣   a⃣   c⃣   t⃣   e⃣   r⃣   s⃣   .⃣\n\n## bent\n\nWonky alternatives to the usual characters.\n\nచօղҟվ ąӀէҽɾղąէìѵҽʂ էօ էհҽ մʂմąӀ çհąɾąçէҽɾʂ.\n\n## tiny\n\nTiny Capitals.\n\nᴛɪɴʏ ᴄᴀᴘɪᴛᴀʟꜱ.\n\n\n\n# Links and Thanks\n<ul>\n\t<li><a href=\"http://www.fileformat.info/\">FileFormat.info</a> - The best Unicode reference</li>\n\t<li><a href=\"http://en.wikipedia.org/wiki/Transformation_of_text\">Wikipedia: Transformation of Text</a> - Table for flipped characters and others infos</li>\n\t<li><a href=\"http://www.reddit.com/r/unicode\">reddit.com/r/unicode</a> - The webs biggest unicode-for-fun community (needs more members)</li>\n\t<li><a href=\"http://www.revfad.com/flip.html\">David Fadens Flip</a> - Initial inspiration and characters</li>\n\t<li><a href=\"http://upsidedown.info/\">Thomas Schilds upsidedown.info</a> - Inspiration and comparison</li>\n\t<li><a href=\"http://www.macchiato.com/unicode/mirrored-ascii\">Macchiato - Mirrored ASCII</a> - Initial codepoints for mirrored text</li>\n\t<li><a href=\"http://www.alanwood.net/unicode/enclosed_alphanumerics.html\">Alan Wood’s Unicode Resources</a> - Codepoints for Bubble Text</li>\n\t<li><a href=\"http://en.wikipedia.org/wiki/Combining_character\">Wikipedia: Combining Character</a> - For Creepify, Upsidedown Umlauts, Squares, ...</li>\n\t<li><a href=\"http://blogs.msdn.com/b/michkap/archive/2006/02/17/533929.aspx\">Michael Kaplan's \"What do you get when you combine a base character with a buttload of diacritics?\"</a> - Idea for creepify</li>\n\t<li><a href=\"http://unicodeemoticons.com/\">Unicode emoticons</a>, <a href=\"http://www.planetminecraft.com/blog/collection-of-unicode-faces/\">Collection of unicode faces</a> and <a href=\"https://gist.github.com/157796\">Unicode smileys</a></li>\t\t\t\t\t\n\t<li><a href=\"http://funicode.com\">funicode.com</a> - Idea and lower case characters for Bent</li>\n</ul>\n"
  },
  {
    "path": "demo/index.html",
    "content": "<!DOCTYPE html>\n<html>\n\t<head>\n\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n\t\t<title>Lunicode.js Demo</title>\n\n\t\t<script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js\"></script>\n\n\t\t<script type=\"text/javascript\" src=\"../lunicode.js\"></script>\n\t\t\n\n\t\t<style type=\"text/css\" media=\"screen\">\n\t\t\tbody {\n\t\t\t\tfont-family: Helvetica, Arial, sans-serif;\n\t\t\t}\n\t\t</style>\t\n\t\t\n\t\t<script type=\"text/javascript\">\n\t\t\t$(function() {\n\t\t\t\t\n\t\t\t\t// Get the Lunicode object, initializing the effects\n\t\t\t\tvar luni = new Lunicode();\n\t\t\t\t\n\t\t\t\t// jQuery is not required, i'm just lazy.\n\t\t\t\t$('.demo').each(function() {\n\t\t\t\t\t$this = $(this);\n\t\t\t\t\tvar effectName = $this.attr('id').split(\"_\")[1]; // flip, mirror, ...\t\t\t\t\t\n\t\t\t\t\tvar $p = $('p', $this);\n\t\t\t\t\t\n\t\t\t\t\t// Encode the text\n\t\t\t\t\tvar encodedText = luni.tools[effectName].encode($p.text());\n\t\t\t\t\t\n\t\t\t\t\t/* Special options for creepify:\n\t\t\t\t\tluni.tools.creepify.options.top = true; \t// add diacritics on top. Default: true \n\t\t\t        luni.tools.creepify.options.middle = true;\t// add diacritics in the middle. Default: true \n\t\t\t        luni.tools.creepify.options.bottom = true;\t// add diacritics on the bottom. Default: true\n\t\t\t        luni.tools.creepify.options.maxHeight = 15; // How many diacritic marks shall we put on top/bottom? Default: 15\n\t\t\t        luni.tools.creepify.options.randomization: 100 // 0-100%. maxHeight 100 and randomization 20%: the height goes from 80 to 100. randomization 70%, height goes from 30 to 100. Default: 100\n\t\t\t\t\t*/\n\t\t\t\t\t\n\t\t\t\t\t// Replace the text with the encoded version\n\t\t\t\t\t$p.text(encodedText);\n\t\t\t\t\t\n\t\t\t\t\t// To convert the text to HTML entities, use luni.getHTML(text):\n\t\t\t\t\t$p.html(luni.getHTML(encodedText));\n\t\t\t\t\t\n\t\t\t\t\t// To decode text back to ascii, use the decode method:\n\t\t\t\t\t// var plainText = luni.tools[effectName].decode(encodedText);\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t});\n\t\t\t\t\n\t\t\t});\t\t\t\n\t\t</script>\n\t</head>\n\t<body>\n\t\t<h1>Lunicode.js Demo</h1>\n\t\t<p>For a nicer interactive demo go to <a href=\"http://lunicode.com\">lunicode.com</a>.</p>\n\t\t<p>\n\t\t\tIf it looks weird and boxy, you need a Unicode font:\n\t\t</p>\n\t\t<ul>\n\t\t\t<li><a target=\"_blank\" href=\"http://dejavu-fonts.org/wiki/Main_Page\">DejaVu Sans</a></li>\n\t\t\t<li><a target=\"_blank\" href=\"http://www.fonts2u.com/code2000.font\">Code2000</a></li>\n\t\t\t<li><a target=\"_blank\" href=\"http://www.lgm.cl/trabajos/unifont/index.en.html\">GNU Unifont</a></li>\n\t\t\t<li><a target=\"_blank\" href=\"http://web.nickshanks.com/fonts/kannada/\">Kedage</a></li>\n\t\t</ul>\n\t\t\n\t\t\n\t\t<div class=\"demo\" id=\"demo_flip\">\n\t\t\t<h2>Flip</h2>\n\t\t\t<p>Flips/Rotates text, including numbers (12345) and some special characters: äöü éáú ÄÖÜ ß ô</p>\n\t\t</div>\n\t\t\n\t\t<div class=\"demo\" id=\"demo_mirror\">\n\t\t\t<h2>Mirror</h2>\n\t\t\t<p>Mirrors text horizontally. äöü ß èàù. Käseküchlein.</p>\n\t\t</div>\n\t\t\n\t\t<div class=\"demo\" id=\"demo_creepify\">\n\t\t\t<h2>Creepify</h2>\n\t\t\t<p>Adds\n\t\t\t\tdiacritics</p>\n\t\t</div>\n\t\t\n\t\t<div class=\"demo\" id=\"demo_bubbles\">\n\t\t\t<h2>Bubbles</h2>\n\t\t\t<p>Bubbles around normal characters. Uses combining characters for everything else.</p>\n\t\t</div>\n\t\t\n\t\t<div class=\"demo\" id=\"demo_squares\">\n\t\t\t<h2>Squares</h2>\n\t\t\t<p>Squares, via combining characters.</p>\n\t\t</div>\n\t\t\n\t\t<div class=\"demo\" id=\"demo_roundsquares\">\n\t\t\t<h2>Round Squares</h2>\n\t\t\t<p>Round squares, via combining characters.</p>\n\t\t</div>\n\t\t\n\t\t<div class=\"demo\" id=\"demo_bent\">\n\t\t\t<h2>Bent</h2>\n\t\t\t<p>Wonky alternatives to the usual characters.</p>\n\t\t</div>\n\t\t\n\t\t<div class=\"demo\" id=\"demo_tiny\">\n\t\t\t<h2>Tiny</h2>\n\t\t\t<p>Tiny Capitals.</p>\n\t\t</div>\n\t\t\n\t\t<p style=\"margin-top: 100px\"><a href=\"https://github.com/combatwombat/Lunicode.js\">Lunicode.js on GitHub</a></p>\n\t\t<p>Copyright &copy; 2012 Robert Gerlach - <a href=\"http://robsite.net\">robsite.net</a></p>\n\t\t\n\t</body>\n</html>"
  },
  {
    "path": "lunicode.js",
    "content": "module.exports = new Lunicode();\nfunction Lunicode() {\n  this.tools = {\n  \n    // Flip/rotate Text by 180°\n    \n    flip: {\n      init: function() {\n                \n        // invert the map\n        for (i in this.map) {\n          this.map[this.map[i]] = i;\n        }\n        \n      },\n      \n      encode: function(text) {\n        var ret = [],\n            ch;\n        \n        for (var i = 0, len = text.length; i < len; i++) {\n          ch = text.charAt(i);\n          \n          // combining diacritical marks: combine with previous character for ä,ö,ü,...\n          if (i > 0 && (ch == '\\u0324' ||\n                        ch == '\\u0317' ||\n                        ch == '\\u0316' ||\n                        ch == '\\u032e')) {\n            ch = this.map[text.charAt(i-1) + ch];\n            ret.pop();             \n                          \n          } else {\n            ch = this.map[ch];\n            if (typeof(ch) == \"undefined\") {\n              ch = text.charAt(i);\n            }\n          }\n          \n          ret.push(ch); \n          \n\n\n        }    \n\n        return ret.reverse().join(\"\");\n      },\n      \n      // same as encode(), for now...\n      decode: function(text) {\n        var ret = [],\n            ch;\n        \n        for (var i = 0, len = text.length; i < len; i++) {\n          ch = text.charAt(i);\n          \n          // combining diacritical marks: combine with previous character for ä,ö,ü,...\n          if (i > 0 && (ch == '\\u0324' ||\n                        ch == '\\u0317' ||\n                        ch == '\\u0316' ||\n                        ch == '\\u032e')) {\n            ch = this.map[text.charAt(i-1) + ch];\n            ret.pop();\n            \n          } else {\n            ch = this.map[ch];\n            if (typeof(ch) == \"undefined\") {\n              ch = text.charAt(i);\n            }\n          }          \n\n          ret.push(ch);          \n        }\n        return ret.reverse().join(\"\");\n      },\n      \n      map: {\n          // Thanks to\n          // - David Faden: http://www.revfad.com/flip.html\n          // - http://en.wikipedia.org/wiki/Transformation_of_text\n          'a' : '\\u0250',\n          'b' : 'q',      \n          'c' : '\\u0254', \n          'd' : 'p',      \n          'e' : '\\u01DD', \n          'f' : '\\u025F', \n          'g' : '\\u0253', \n          'h' : '\\u0265', \n          'i' : '\\u0131', \n          'j' : '\\u027E', \n          'k' : '\\u029E',\n          'l' : '\\u006C',\n          'm' : '\\u026F',\n          'n' : 'u',\n          'r' : '\\u0279',\n          't' : '\\u0287',\n          'v' : '\\u028C',\n          'w' : '\\u028D',\n          'y' : '\\u028E',\n          'A' : '\\u2200',\n          'B' : 'ᙠ',\n          'C' : '\\u0186',\n          'D' : 'ᗡ',\n          'E' : '\\u018e',\n          'F' : '\\u2132',\n          'G' : '\\u2141',\n          'J' : '\\u017f',\n          'K' : '\\u22CA',\n          'L' : '\\u02e5',\n          'M' : 'W',\n          'P' : '\\u0500',\n          'Q' : '\\u038C',\n          'R' : '\\u1D1A',\n          'T' : '\\u22a5',\n          'U' : '\\u2229',\n          'V' : '\\u039B',\n          'Y' : '\\u2144',\n          '1' : '\\u21c2',\n          '2' : '\\u1105',\n          '3' : '\\u0190',\n          '4' : '\\u3123',\n          '5' : '\\u078e',\n          '6' : '9',\n          '7' : '\\u3125',\n          '&' : '\\u214b',\n          '.' : '\\u02D9',\n          '\"' : '\\u201e',\n          ';' : '\\u061b',\n          '[' : ']',\n          '(' : ')',\n          '{' : '}',\n          '?' : '\\u00BF', \n          '!' : '\\u00A1',\n          \"\\'\" : ',',\n          '<' : '>',\n          '\\u203E' : '_',\n          '\\u00AF' : '_',\n          '\\u203F' : '\\u2040',\n          '\\u2045' : '\\u2046',\n          '\\u2234' : '\\u2235',\n          '\\r' : '\\n',\n          'ß' : 'ᙠ',\n          \n          '\\u0308':  '\\u0324',\n          'ä' : 'ɐ'+'\\u0324',\n          'ö' : 'o'+'\\u0324',\n          'ü' : 'n'+'\\u0324',\n          'Ä' : '\\u2200'+'\\u0324',\n          'Ö' : 'O'+'\\u0324',\n          'Ü' : '\\u2229'+'\\u0324',\n          \n          '´' : ' \\u0317',\n          'é' : '\\u01DD' + '\\u0317',\n          'á' : '\\u0250' + '\\u0317',\n          'ó' : 'o' + '\\u0317',\n          'ú' : 'n' + '\\u0317',\n          'É' : '\\u018e' + '\\u0317',\n          'Á' : '\\u2200' + '\\u0317',\n          'Ó' : 'O' + '\\u0317',\n          'Ú' : '\\u2229' + '\\u0317',\n          \n          '`' : ' \\u0316',\n          'è' : '\\u01DD' + '\\u0316',\n          'à' : '\\u0250' + '\\u0316',\n          'ò' : 'o' + '\\u0316',\n          'ù' : 'n' + '\\u0316',\n          'È' : '\\u018e' + '\\u0316',\n          'À' : '\\u2200' + '\\u0316',\n          'Ò' : 'O' + '\\u0316',\n          'Ù' : '\\u2229' + '\\u0316',\n          \n          '^' : ' \\u032E',\n          'ê' : '\\u01DD' + '\\u032e',\n          'â' : '\\u0250' + '\\u032e',\n          'ô' : 'o' + '\\u032e',\n          'û' : 'n' + '\\u032e',\n          'Ê' : '\\u018e' + '\\u032e',\n          'Â' : '\\u2200' + '\\u032e',\n          'Ô' : 'O' + '\\u032e',\n          'Û' : '\\u2229' + '\\u032e'\n          // TODO: flip more letters with stuff around them. See http://en.wikipedia.org/wiki/Combining_character\n          \n      }\n    },\n    \n       \n    \n    \n    // Mirror text (flip horizontally)\n    mirror: {\n      init: function() {\n                \n        // invert the map\n        for (i in this.map) {\n          this.map[this.map[i]] = i;\n        }\n        \n      },\n      \n      encode: function(text) {\n        var ret = [],\n            ch,\n            newLines = [];\n        \n        for (var i = 0, len = text.length; i < len; i++) {\n          ch = text.charAt(i);\n          \n          // combining diacritical marks: combine with previous character for ä,ö,ü,...\n          if (i > 0 && (ch == '\\u0308' ||\n                        ch == '\\u0300' ||\n                        ch == '\\u0301' ||\n                        ch == '\\u0302')) {\n            ch = this.map[text.charAt(i-1) + ch];\n            ret.pop();\n          } else {\n            ch = this.map[ch];\n            if (typeof(ch) == \"undefined\") {\n              ch = text.charAt(i);\n            }\n          }\n          \n          \n          if (ch == '\\n') {\n            newLines.push(ret.reverse().join(\"\"));\n            ret = [];\n          } else {\n            ret.push(ch);\n          }\n          \n  \n        }    \n        newLines.push(ret.reverse().join(\"\"));\n        return newLines.join(\"\\n\");\n      },\n      \n      decode: function(text) {\n        var ret = [],\n            ch,\n            newLines = [];\n        \n        for (var i = 0, len = text.length; i < len; i++) {\n          ch = text.charAt(i);\n          \n          // combining diacritical marks: combine with previous character for ä,ö,ü,...\n          if (i > 0 && (ch == '\\u0308' ||\n                        ch == '\\u0300' ||\n                        ch == '\\u0301' ||\n                        ch == '\\u0302')) {\n            ch = this.map[text.charAt(i-1) + ch];\n            ret.pop();\n          } else {\n            ch = this.map[ch];\n            if (typeof(ch) == \"undefined\") {\n              ch = text.charAt(i);\n            }\n          }          \n          \n          if (ch == '\\n') {\n            newLines.push(ret.reverse().join(\"\"));\n            ret = [];\n          } else {\n            ret.push(ch);\n          }\n        }\n        \n        newLines.push(ret.reverse().join(\"\"));\n        return newLines.join(\"\\n\");\n      },\n      \n      // Thanks to http://www.macchiato.com/unicode/mirrored-ascii\n      map: {         \n          'a' : 'ɒ',\n          'b' : 'd',      \n          'c' : 'ɔ',       \n          'e' : 'ɘ', \n          'f' : 'Ꮈ', \n          'g' : 'ǫ', \n          'h' : 'ʜ',  \n          'j' : 'ꞁ', \n          'k' : 'ʞ',\n          'l' : '|',\n          'n' : 'ᴎ',\n          'p' : 'q',\n          'r' : 'ɿ',\n          's' : 'ꙅ',\n          't' : 'ƚ',\n          'y' : 'ʏ',\n          'z' : 'ƹ',\n          'B' : 'ᙠ',\n          'C' : 'Ɔ',\n          'D' : 'ᗡ',\n          'E' : 'Ǝ',\n          'F' : 'ꟻ',\n          'G' : 'Ꭾ',\n          'J' : 'Ⴑ',\n          'K' : '⋊',\n          'L' : '⅃',\n          'N' : 'Ͷ',\n          'P' : 'ꟼ',\n          'Q' : 'Ọ',\n          'R' : 'Я',\n          'S' : 'Ꙅ',\n          'Z' : 'Ƹ',\n          '1' : '',\n          '2' : '',\n          '3' : '',\n          '4' : '',\n          '5' : '',\n          '6' : '',\n          '7' : '',\n          '&' : '',\n          ';' : '',\n          '[' : ']',\n          '(' : ')',\n          '{' : '}',\n          '?' : '⸮', \n          '<' : '>',\n          \n          'ä' : 'ɒ'+'\\u0308',\n          'ß' : 'ᙠ',\n          \n          '´' : '`',\n          'é' : 'ɘ' + '\\u0300',\n          'á' : 'ɒ' + '\\u0300',\n          'ó' : 'ò',\n          'ú' : 'ù',\n          'É' : 'Ǝ' + '\\u0300',\n          'Á' : 'À',\n          'Ó' : 'Ò',\n          'Ú' : 'Ù',\n          \n          '`' : '´',\n          'è' : 'ɘ' + '\\u0301',\n          'à' : 'ɒ' + '\\u0301',\n          'È' : 'Ǝ' + '\\u0301',\n\n          'ê' : 'ɘ' + '\\u0302',\n          'â' : 'ɒ' + '\\u0302',\n          'Ê' : 'Ǝ' + '\\u0302',\n          \n          'Ø' : 'ᴓ',\n          'ø' : 'ᴓ'\n          \n      }\n    },\n    \n    // Thanks to Michael S. Kaplan: http://blogs.msdn.com/b/michkap/archive/2006/02/17/533929.aspx\n    // Creepify.\n    creepify: {\n      init: function() {\n        \n        // Sort diacritics in top, bottom or middle\n\n        for (var i = 768; i <= 789; i++) {\n          this.diacriticsTop.push(String.fromCharCode(i));\n        }\n        \n        for (var i = 790; i <= 819; i++) {\n          if (i != 794 && i != 795) {\n            this.diacriticsBottom.push(String.fromCharCode(i));\n          }\n        }\n        this.diacriticsTop.push(String.fromCharCode(794));\n        this.diacriticsTop.push(String.fromCharCode(795));\n        \n        for (var i = 820; i <= 824; i++) {\n          this.diacriticsMiddle.push(String.fromCharCode(i));\n        }\n        \n        for (var i = 825; i <= 828; i++) {\n          this.diacriticsBottom.push(String.fromCharCode(i));\n        }\n        \n        for (var i = 829; i <= 836; i++) {\n          this.diacriticsTop.push(String.fromCharCode(i));\n        }\n        this.diacriticsTop.push(String.fromCharCode(836));\n        this.diacriticsBottom.push(String.fromCharCode(837));\n        this.diacriticsTop.push(String.fromCharCode(838));\n        this.diacriticsBottom.push(String.fromCharCode(839));\n        this.diacriticsBottom.push(String.fromCharCode(840));\n        this.diacriticsBottom.push(String.fromCharCode(841));\n        this.diacriticsTop.push(String.fromCharCode(842));\n        this.diacriticsTop.push(String.fromCharCode(843));\n        this.diacriticsTop.push(String.fromCharCode(844));\n        this.diacriticsBottom.push(String.fromCharCode(845));\n        this.diacriticsBottom.push(String.fromCharCode(846));\n        // 847 (U+034F) is invisible http://en.wikipedia.org/wiki/Combining_grapheme_joiner\n        this.diacriticsTop.push(String.fromCharCode(848));\n        this.diacriticsTop.push(String.fromCharCode(849));\n        this.diacriticsTop.push(String.fromCharCode(850));\n        this.diacriticsBottom.push(String.fromCharCode(851));\n        this.diacriticsBottom.push(String.fromCharCode(852));\n        this.diacriticsBottom.push(String.fromCharCode(853));\n        this.diacriticsBottom.push(String.fromCharCode(854));\n        this.diacriticsTop.push(String.fromCharCode(855));\n        this.diacriticsTop.push(String.fromCharCode(856));\n        this.diacriticsBottom.push(String.fromCharCode(857));\n        this.diacriticsBottom.push(String.fromCharCode(858));\n        this.diacriticsTop.push(String.fromCharCode(859));\n        this.diacriticsBottom.push(String.fromCharCode(860));\n        this.diacriticsTop.push(String.fromCharCode(861));\n        this.diacriticsTop.push(String.fromCharCode(861));\n        this.diacriticsBottom.push(String.fromCharCode(863));\n        this.diacriticsTop.push(String.fromCharCode(864));\n        this.diacriticsTop.push(String.fromCharCode(865));\n        \n\n      },\n      \n      encode: function(text) {\n        var newText = '',\n            newChar;\n        for (i in text) {\n          newChar = text[i];\n          \n          // Middle\n          // Put just one of the middle characters there, or it gets crowded\n          if (this.options.middle) {\n              newChar += this.diacriticsMiddle[Math.floor(Math.random()*this.diacriticsMiddle.length)]          \n          }\n          \n          // Top    \n          if (this.options.top) {\n            \n            // Put up to this.options.maxHeight random diacritics on top.\n            // optionally fluctuate the number via the randomization value (0-100%)\n            // randomization 100%: 0 to maxHeight\n            //                30%: 70% of maxHeight to maxHeight\n            //                 x%: 100-x% of maxHeight to maxHeight \n            var diacriticsTopLength = this.diacriticsTop.length - 1;\n            for (var  count = 0,\n                      len = this.options.maxHeight - Math.random()*((this.options.randomization/100)*this.options.maxHeight); count < len; count++) {\n                        \n              newChar += this.diacriticsTop[Math.floor(Math.random()*diacriticsTopLength)]          \n                        \n            }\n\n          }      \n\n          \n          // Bottom    \n          if (this.options.bottom) {\n            \n            var diacriticsBottomLength = this.diacriticsBottom.length - 1;\n            for (var  count = 0,\n                      len = this.options.maxHeight - Math.random()*((this.options.randomization/100)*this.options.maxHeight); count < len; count++) {\n                        \n              newChar += this.diacriticsBottom[Math.floor(Math.random()*diacriticsBottomLength)]          \n                        \n            }\n\n          }\n          \n          \n          newText += newChar;\n        }\n        return newText;\n      },\n      \n      decode: function(text) {\n        var newText = '',\n            charCode;\n            \n        for (i in text) {\n          charCode = text[i].charCodeAt(0);\n          if (charCode < 768 || charCode > 865) {\n            newText += text[i];\n          }\n        }\n        return newText;\n      },\n      \n      diacriticsTop: [],\n      diacriticsMiddle: [],\n      diacriticsBottom: [],\n      \n      options: {\n        top: true,\n        middle: true,\n        bottom : true,\n        maxHeight: 15,   // How many diacritic marks shall we put on top/bottom?\n        randomization: 100 // 0-100%. maxHeight 100 and randomization 20%: the height goes from 80 to 100. randomization 70%, height goes from 30 to 100.\n      }\n    },\n    \n    \n    // Circles around Letters. Uses special circle characters for some letters and combining characters for the rest\n    // Thanks to\n    // - Alan Wood: http://www.alanwood.net/unicode/enclosed_alphanumerics.html\n    bubbles: {\n      init: function() {\n        \n        \n        \n        // Numbers\n        for (var i = 49; i <= 57; i++) {\n          this.map[String.fromCharCode(i)] = String.fromCharCode(i+9263);\n        }\n        this.map['0'] = '\\u24ea';\n        \n        // Capital letters\n        for (var i = 65; i <= 90; i++) {\n          this.map[String.fromCharCode(i)] = String.fromCharCode(i+9333);\n        }\n        \n        // Lower letters\n        for (var i = 97; i <= 122; i++) {\n          this.map[String.fromCharCode(i)] = String.fromCharCode(i+9327);\n        }\n                \n        // invert the map\n        for (i in this.map) {\n          this.mapInverse[this.map[i]] = i;\n        }\n        \n      },\n      \n      encode: function(text) {\n        var ret = \"\",\n            ch,\n            first = true;\n            \n        for (i in text) {\n          ch = this.map[text[i]];\n\n          // No dedicated circled character available? Use a Combining Diacritical Mark surrounded\n          // with non-breaking spaces, so it doesn't overlap\n          if ((typeof(ch) == \"undefined\")) {\n            if (text[i].charCodeAt(0) >= 33) {\n              ch = text[i] + String.fromCharCode(8413);\n              if (!first) {\n                ch = String.fromCharCode(8239) + String.fromCharCode(160) + String.fromCharCode(160) + String.fromCharCode(8239) + ch;\n              }\n            } else {\n              ch = text[i];\n            }\n          }\n          ret += ch;\n          first = (ch == '\\n');\n        }\n        return ret;\n      },\n      \n      decode: function(text) {\n        var ret = \"\",\n            ch,\n            newRet = '';\n            \n        for (i in text) {\n          ch = this.mapInverse[text[i]];\n          ret += ((typeof(ch) == \"undefined\") ? text[i] : ch);\n        }\n        \n        for (i in ret) {\n          ch = ret[i].charCodeAt(0);\n          if (ch != 160 && ch != 8239 && ch != 8413) {\n            newRet += ret[i];\n          }\n        }\n        \n        return newRet;\n      },\n      \n      map: {},\n      mapInverse: {}\n    },\n    \n    \n    \n    // Puts a Square Combining Character after a letter, thus ensquaring it, squarily.\n    squares: {\n      init: function() {},\n      \n      encode: function(text) {\n        var ret = \"\",\n            ch,\n            first = true;\n            \n        for (i in text) {\n          if (text[i].charCodeAt(0) >= 33) {\n            ch = text[i] + String.fromCharCode(8414);\n            if (!first) {\n              ch = String.fromCharCode(8239) + String.fromCharCode(160) + String.fromCharCode(160) + String.fromCharCode(8239) + ch;\n            }\n          } else {\n            ch = text[i];\n          }\n          \n          ret += ch;\n          first = (ch == '\\n');\n        }\n        return ret;\n      },\n      \n      decode: function(text) {\n        var ret = \"\",\n            ch;\n            \n        for (i in text) {\n          ch = text[i].charCodeAt(0);\n          if (ch != 160 && ch != 8239 && ch != 8414) {\n            ret += text[i];\n          }\n        }\n        \n        return ret;\n      }\n    },\n    \n    \n    // Same as squares, just round.\n    roundsquares: {\n      init: function() {},\n      \n      encode: function(text) {\n        var ret = \"\",\n            ch,\n            first = true;\n            \n        for (i in text) {\n          if (text[i].charCodeAt(0) >= 33) {\n            ch = text[i] + String.fromCharCode(8419);\n            if (!first) {\n              ch = String.fromCharCode(160) + String.fromCharCode(160) + String.fromCharCode(160) + ch;\n            }\n          } else {\n            ch = text[i];\n          }\n          \n          ret += ch;\n          first = (ch == '\\n');\n        }\n        return ret;\n      },\n      \n      decode: function(text) {\n        var ret = \"\",\n            ch;\n            \n        for (i in text) {\n          ch = text[i].charCodeAt(0);\n          if (ch != 160 && ch != 8239 && ch != 8419) {\n            ret += text[i];\n          }\n        }\n        \n        return ret;\n      }\n    },\n    \n    \n    // Weird looking alternatives to most characters\n    bent: {\n      init: function() {\n\n        // invert the map\n        for (i in this.map) {\n          this.map[this.map[i]] = i;\n        }\n\n      },\n\n      encode: function(text) {\n        var ret = '',\n            ch;\n\n        for (var i = 0, len = text.length; i < len; i++) {\n          ch = this.map[text.charAt(i)];\n          if (typeof(ch) == \"undefined\") {\n            ch = text.charAt(i);\n          }\n          ret +=  ch;\n\n        }    \n\n        return ret;\n      },\n\n      decode: function(text) {\n        var ret = '',\n            ch;\n\n        for (var i = 0, len = text.length; i < len; i++) {\n          ch = this.map[text.charAt(i)];\n          if (typeof(ch) == \"undefined\") {\n              ch = text.charAt(i);\n          }\n          ret += ch;          \n        }\n        return ret;\n      },\n\n      // Thanks to Eddie Ringle for most lowercase letters: http://funicode.com\n      map: {        \n          'a' : 'ą',\n          'b' : 'ҍ',      \n          'c' : 'ç',  \n          'd' : 'ժ',     \n          'e' : 'ҽ', \n          'f' : 'ƒ', \n          'g' : 'ց', \n          'h' : 'հ', \n          'i' : 'ì',           \n          'j' : 'ʝ', \n          'k' : 'ҟ',\n          'l' : 'Ӏ',\n          'm' : 'ʍ',\n          'n' : 'ղ',\n          'o' : 'օ',\n          'p' : 'ք',\n          'q' : 'զ',\n          'r' : 'ɾ',\n          's' : 'ʂ',\n          't' : 'է',\n          'u' : 'մ',\n          'v' : 'ѵ',\n          'w' : 'ա',\n          'x' : '×',\n          'y' : 'վ',\n          'z' : 'Հ',\n          'A' : 'Ⱥ',\n          'B' : 'β',\n          'C' : '↻',\n          'D' : 'Ꭰ',\n          'E' : 'Ɛ',\n          'F' : 'Ƒ',\n          'G' : 'Ɠ',\n          'H' : 'Ƕ',\n          'I' : 'į',\n          'J' : 'ل',\n          'K' : 'Ҡ',\n          'L' : 'Ꝉ',\n          'M' : 'Ɱ',\n          'N' : 'ហ',\n          'O' : 'ට',\n          'P' : 'φ',\n          'Q' : 'Ҩ',\n          'R' : 'འ',\n          'S' : 'Ϛ',\n          'T' : 'Ͳ',\n          'U' : 'Ա',\n          'V' : 'Ỽ',\n          'W' : 'చ',\n          'X' : 'ჯ',\n          'Y' : 'Ӌ',\n          'Z' : 'ɀ',\n          '0' : '⊘',\n          '1' : '������',\n          '2' : 'ϩ',\n          '3' : 'Ӡ',\n          '4' : '५',\n          '5' : 'Ƽ',\n          '6' : 'Ϭ',\n          '7' : '7',\n          '8' : '������',\n          '9' : '९',\n          '&' : '⅋',\n          '(' : '{',\n          ')' : '}',\n          '{' : '(',\n          '}' : ')',\n          \n          'ä' : 'ą'+'\\u0308',\n          'ö' : 'օ'+'\\u0308',\n          'ü' : 'մ'+'\\u0308',\n          'Ä' : 'Ⱥ'  + '\\u0308',\n          'Ö' : 'ට'+'\\u0308',\n          'Ü' : 'Ա'+'\\u0308',\n          \n          'é' : 'ҽ' + '\\u0301',\n          'á' : 'ą' + '\\u0301',\n          'ó' : 'օ' + '\\u0301',\n          'ú' : 'մ' + '\\u0301',\n          'É' : 'Ɛ' + '\\u0301',\n          'Á' : 'Ⱥ' +  '\\u0301',\n          'Ó' : 'ට' + '\\u0301',\n          'Ú' : 'Ա' + '\\u0301',\n          \n          'è' : 'ҽ' + '\\u0300',\n          'à' : 'ą' + '\\u0300',\n          'ò' : 'օ' + '\\u0300',\n          'ù' : 'մ' + '\\u0300',\n          'È' : 'Ɛ' + '\\u0300',\n          'À' : 'Ⱥ'  +  '\\u0300',\n          'Ò' : 'ට' + '\\u0300',\n          'Ù' : 'Ա' + '\\u0300',\n          \n          'ê' : 'ҽ' + '\\u0302',\n          'â' : 'ą' + '\\u0302',\n          'ô' : 'օ' + '\\u0302',\n          'û' : 'մ' + '\\u0302',\n          'Ê' : 'Ɛ' + '\\u0302',\n          'Â' : 'Ⱥ'  +  '\\u0302',\n          'Ô' : 'ට' + '\\u0302',\n          'Û' : 'Ա' + '\\u0302'        \n      }\n    },\n    \n    \n    // Tiny Capitals\n    tiny: {\n      init: function() {\n\n        // invert the map\n        for (i in this.map) {\n          this.map[this.map[i]] = i;\n        }\n\n      },\n\n      encode: function(text) {\n        var ret = '',\n            ch;\n        text = text.toUpperCase();\n        for (var i = 0, len = text.length; i < len; i++) {\n          ch = this.map[text.charAt(i)];\n          if (typeof(ch) == \"undefined\") {\n            ch = text.charAt(i);\n          }\n          ret +=  ch;\n\n        }    \n\n        return ret;\n      },\n\n      decode: function(text) {\n        var ret = '',\n            ch;\n\n        for (var i = 0, len = text.length; i < len; i++) {\n          ch = this.map[text.charAt(i)];\n          if (typeof(ch) == \"undefined\") {\n              ch = text.charAt(i);\n          }\n          ret += ch;          \n        }\n        return ret;\n      },\n\n      // TODO: Find small lower case letters\n      map: {        \n          'A' : 'ᴀ',\n          'B' : 'ʙ',\n          'C' : 'ᴄ',\n          'D' : 'ᴅ',\n          'E' : 'ᴇ',\n          'F' : 'ꜰ',\n          'G' : 'ɢ',\n          'H' : 'ʜ',\n          'I' : 'ɪ',\n          'J' : 'ᴊ',\n          'K' : 'ᴋ',\n          'L' : 'ʟ',\n          'M' : 'ᴍ',\n          'N' : 'ɴ',\n          'O' : 'ᴏ',\n          'P' : 'ᴘ',\n          'Q' : 'Q',\n          'R' : 'ʀ',\n          'S' : 'ꜱ',\n          'T' : 'ᴛ',\n          'U' : 'ᴜ',\n          'V' : 'ᴠ',\n          'W' : 'ᴡ',\n          'X' : 'x',\n          'Y' : 'ʏ',\n          'Z' : 'ᴢ'\n      }\n    }\n\n   \n    \n    \n  };\n  \n  \n\n  ////// functions\n\n  \n  // init\n  for (i in this.tools) {\n    this.tools[i].init();\n  }\n  \n  \n  \n  // Encode every character: U+00A0 -> &#x00a0; etc. \n  this.getHTML = function(text) {\n    var html = '',\n        ch,\n        lastSpaceWasNonBreaking = true, // for alternating [non-braking] spaces\n        highSurrogate = 0,\n        codepoint = 0;        \n        \n    for (var i = 0, len = text.length; i < len; i++) {\n      ch = text.charCodeAt(i);\n      \n      // line break: add <br>\\n\n      if (ch == 10 || ch == 13) {\n        html += '<br>\\n';\n        lastSpaceWasNonBreaking = true;\n        \n      // space: add alternating space and non-breaking space (U+00A0). Otherwise\n      // a series of normal spaces       would collapse to one in the browser  \n      } else if (ch == 32) {\n        if (lastSpaceWasNonBreaking) {\n          html += ' ';\n          lastSpaceWasNonBreaking = false;\n        } else {\n          html += '&nbsp;';\n          lastSpaceWasNonBreaking = true;\n        }        \n      \n      // Normal character: Decode. Special cases for higher numbers:\n      // http://en.wikipedia.org/wiki/Mapping_of_Unicode_characters#Surrogates\n      } else {\n        \n        \n        // Character is high surrogate: Remember and continue\n        if (ch >= 0xD800 && ch <= 0xDBFF) {\n          highSurrogate = ch;\n          codepoint = 0;\n        \n        // last character was high surrogate: Combine with low surrogate  \n        } else if (highSurrogate > 0) {\n          \n          // If char is low surrogate:\n          if (ch >= 0xDC00 && ch <= 0xDFFF) {\n            codepoint = (highSurrogate-0xD800)*1024 + (ch-0xDC00) + 0x10000;\n          }\n          highSurrogate = 0;\n        \n        // no surrogates: Just take the character  \n        } else {\n          codepoint = ch;\n        }\n\n        if (codepoint != 0) {\n          html += '&#x' + codepoint.toString(16) + ';';\n          lastSpaceWasNonBreaking = true;\n        }\n\n      }\n    }\n    \n    return html;\n  }  \n}"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"lunicode\",\n  \"version\": \"2.0.1\",\n  \"description\": \"Converts text in various useless but amusing ways.\",\n  \"main\": \"lunicode.js\",\n  \"scripts\": {\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://combatwombat@github.com/combatwombat/Lunicode.js.git\"\n  },\n  \"keywords\": [\n    \"unicode\"\n  ],\n  \"author\": \"Robert Gerlach\",\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/combatwombat/Lunicode.js/issues\"\n  },\n  \"homepage\": \"https://github.com/combatwombat/Lunicode.js#readme\"\n}\n"
  }
]