diff options
Diffstat (limited to 'deps/npm/node_modules/colors/lib/custom/zalgo.js')
-rw-r--r-- | deps/npm/node_modules/colors/lib/custom/zalgo.js | 51 |
1 files changed, 23 insertions, 28 deletions
diff --git a/deps/npm/node_modules/colors/lib/custom/zalgo.js b/deps/npm/node_modules/colors/lib/custom/zalgo.js index 1ab3891717..45c89a8d30 100644 --- a/deps/npm/node_modules/colors/lib/custom/zalgo.js +++ b/deps/npm/node_modules/colors/lib/custom/zalgo.js @@ -1,8 +1,8 @@ // please no module['exports'] = function zalgo(text, options) { - text = text || ' he is here '; + text = text || " he is here "; var soul = { - 'up': [ + "up" : [ '̍', '̎', '̄', '̅', '̿', '̑', '̆', '̐', '͒', '͗', '͑', '̇', @@ -15,9 +15,9 @@ module['exports'] = function zalgo(text, options) { 'ͦ', 'ͧ', 'ͨ', 'ͩ', 'ͪ', 'ͫ', 'ͬ', 'ͭ', 'ͮ', 'ͯ', '̾', '͛', - '͆', '̚', + '͆', '̚' ], - 'down': [ + "down" : [ '̖', '̗', '̘', '̙', '̜', '̝', '̞', '̟', '̠', '̤', '̥', '̦', @@ -27,27 +27,28 @@ module['exports'] = function zalgo(text, options) { '̺', '̻', '̼', 'ͅ', '͇', '͈', '͉', '͍', '͎', '͓', '͔', '͕', - '͖', '͙', '͚', '̣', + '͖', '͙', '͚', '̣' ], - 'mid': [ + "mid" : [ '̕', '̛', '̀', '́', '͘', '̡', '̢', '̧', '̨', '̴', '̵', '̶', '͜', '͝', '͞', '͟', '͠', '͢', '̸', - '̷', '͡', ' ҉', - ], - }; - var all = [].concat(soul.up, soul.down, soul.mid); + '̷', '͡', ' ҉' + ] + }, + all = [].concat(soul.up, soul.down, soul.mid), + zalgo = {}; function randomNumber(range) { var r = Math.floor(Math.random() * range); return r; } - function isChar(character) { + function is_char(character) { var bool = false; - all.filter(function(i) { + all.filter(function (i) { bool = (i === character); }); return bool; @@ -55,25 +56,19 @@ module['exports'] = function zalgo(text, options) { function heComes(text, options) { - var result = ''; - var counts; - var l; + var result = '', counts, l; options = options || {}; - options['up'] = - typeof options['up'] !== 'undefined' ? options['up'] : true; - options['mid'] = - typeof options['mid'] !== 'undefined' ? options['mid'] : true; - options['down'] = - typeof options['down'] !== 'undefined' ? options['down'] : true; - options['size'] = - typeof options['size'] !== 'undefined' ? options['size'] : 'maxi'; + options["up"] = typeof options["up"] !== 'undefined' ? options["up"] : true; + options["mid"] = typeof options["mid"] !== 'undefined' ? options["mid"] : true; + options["down"] = typeof options["down"] !== 'undefined' ? options["down"] : true; + options["size"] = typeof options["size"] !== 'undefined' ? options["size"] : "maxi"; text = text.split(''); for (l in text) { - if (isChar(l)) { + if (is_char(l)) { continue; } result = result + text[l]; - counts = {'up': 0, 'down': 0, 'mid': 0}; + counts = {"up" : 0, "down" : 0, "mid" : 0}; switch (options.size) { case 'mini': counts.up = randomNumber(8); @@ -92,10 +87,10 @@ module['exports'] = function zalgo(text, options) { break; } - var arr = ['up', 'mid', 'down']; + var arr = ["up", "mid", "down"]; for (var d in arr) { var index = arr[d]; - for (var i = 0; i <= counts[index]; i++) { + for (var i = 0 ; i <= counts[index]; i++) { if (options[index]) { result = result + soul[index][randomNumber(soul[index].length)]; } @@ -106,4 +101,4 @@ module['exports'] = function zalgo(text, options) { } // don't summon him return heComes(text, options); -}; +} |