mirror of
				https://github.com/flynx/colors.js.git
				synced 2025-10-31 03:50:11 +00:00 
			
		
		
		
	Added defineProperty check/implementation. Is available (ie node.js) defineProperty is the correct way to add color properties so they aren't enumerable. Unintentional enumerable properties can cause global issues
This commit is contained in:
		
							parent
							
								
									6ce311411e
								
							
						
					
					
						commit
						6045347a38
					
				| @ -48,7 +48,16 @@ var addProperty = function (color, func) { | ||||
|   exports[color] = function (str) { | ||||
|     return func.apply(str); | ||||
|   }; | ||||
| 
 | ||||
|   if (Object.defineProperty) { | ||||
|     Object.defineProperty(Object.prototype, color, { | ||||
|       get : func, | ||||
|       configurable: true, | ||||
|       enumerable: false | ||||
|     }); | ||||
|   } else { | ||||
|       String.prototype.__defineGetter__(color, func); | ||||
|   } | ||||
| }; | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user