mirror of
				https://github.com/flynx/colors.js.git
				synced 2025-10-30 03:20:10 +00:00 
			
		
		
		
	Merge pull request #98 from jennings/zalgo-options
Use the options when summoning Zalgo
This commit is contained in:
		
						commit
						e64daad776
					
				| @ -58,10 +58,10 @@ module['exports'] = function zalgo(text, options) { | ||||
|   function heComes(text, options) { | ||||
|     var result = '', counts, l; | ||||
|     options = options || {}; | ||||
|     options["up"] = options["up"] || true; | ||||
|     options["mid"] = options["mid"] || true; | ||||
|     options["down"] = options["down"] || true; | ||||
|     options["size"] = 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 (is_char(l)) { | ||||
| @ -72,12 +72,12 @@ module['exports'] = function zalgo(text, options) { | ||||
|       switch (options.size) { | ||||
|       case 'mini': | ||||
|         counts.up = randomNumber(8); | ||||
|         counts.min = randomNumber(2); | ||||
|         counts.mid = randomNumber(2); | ||||
|         counts.down = randomNumber(8); | ||||
|         break; | ||||
|       case 'maxi': | ||||
|         counts.up = randomNumber(16) + 3; | ||||
|         counts.min = randomNumber(4) + 1; | ||||
|         counts.mid = randomNumber(4) + 1; | ||||
|         counts.down = randomNumber(64) + 3; | ||||
|         break; | ||||
|       default: | ||||
| @ -100,5 +100,5 @@ module['exports'] = function zalgo(text, options) { | ||||
|     return result; | ||||
|   } | ||||
|   // don't summon him
 | ||||
|   return heComes(text); | ||||
|   return heComes(text, options); | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user