git-off

git off handles large files in git repos
git clone https://noulin.net/git/git-off.git
Log | Files | Refs | README

trap.js (1664B)


      1 module['exports'] = function runTheTrap (text, options) {
      2   var result = "";
      3   text = text || "Run the trap, drop the bass";
      4   text = text.split('');
      5   var trap = {
      6     a: ["\u0040", "\u0104", "\u023a", "\u0245", "\u0394", "\u039b", "\u0414"],
      7     b: ["\u00df", "\u0181", "\u0243", "\u026e", "\u03b2", "\u0e3f"],
      8     c: ["\u00a9", "\u023b", "\u03fe"],
      9     d: ["\u00d0", "\u018a", "\u0500" , "\u0501" ,"\u0502", "\u0503"],
     10     e: ["\u00cb", "\u0115", "\u018e", "\u0258", "\u03a3", "\u03be", "\u04bc", "\u0a6c"],
     11     f: ["\u04fa"],
     12     g: ["\u0262"],
     13     h: ["\u0126", "\u0195", "\u04a2", "\u04ba", "\u04c7", "\u050a"],
     14     i: ["\u0f0f"],
     15     j: ["\u0134"],
     16     k: ["\u0138", "\u04a0", "\u04c3", "\u051e"],
     17     l: ["\u0139"],
     18     m: ["\u028d", "\u04cd", "\u04ce", "\u0520", "\u0521", "\u0d69"],
     19     n: ["\u00d1", "\u014b", "\u019d", "\u0376", "\u03a0", "\u048a"],
     20     o: ["\u00d8", "\u00f5", "\u00f8", "\u01fe", "\u0298", "\u047a", "\u05dd", "\u06dd", "\u0e4f"],
     21     p: ["\u01f7", "\u048e"],
     22     q: ["\u09cd"],
     23     r: ["\u00ae", "\u01a6", "\u0210", "\u024c", "\u0280", "\u042f"],
     24     s: ["\u00a7", "\u03de", "\u03df", "\u03e8"],
     25     t: ["\u0141", "\u0166", "\u0373"],
     26     u: ["\u01b1", "\u054d"],
     27     v: ["\u05d8"],
     28     w: ["\u0428", "\u0460", "\u047c", "\u0d70"],
     29     x: ["\u04b2", "\u04fe", "\u04fc", "\u04fd"],
     30     y: ["\u00a5", "\u04b0", "\u04cb"],
     31     z: ["\u01b5", "\u0240"]
     32   }
     33   text.forEach(function(c){
     34     c = c.toLowerCase();
     35     var chars = trap[c] || [" "];
     36     var rand = Math.floor(Math.random() * chars.length);
     37     if (typeof trap[c] !== "undefined") {
     38       result += trap[c][rand];
     39     } else {
     40       result += c;
     41     }
     42   });
     43   return result;
     44 
     45 }