mirror of
				https://github.com/flynx/object.js.git
				synced 2025-10-30 19:10:11 +00:00 
			
		
		
		
	added mixinFlat(..)
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									b00433a902
								
							
						
					
					
						commit
						a20ea675ee
					
				
							
								
								
									
										13
									
								
								object.js
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								object.js
									
									
									
									
									
								
							| @ -95,6 +95,19 @@ function(root, ...objects){ | |||||||
| 			return o }, root) } | 			return o }, root) } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | // Like .mixin(..) but will mixin all the methods/props/attrs directly 
 | ||||||
|  | // (flatly) into root...
 | ||||||
|  | var mixinFlat =  | ||||||
|  | module.mixinFlat =  | ||||||
|  | function(root, ...objects){ | ||||||
|  | 	return objects | ||||||
|  | 		.reduce(function(root, cur){ | ||||||
|  | 			Object.keys(cur) | ||||||
|  | 				.map(function(k){ | ||||||
|  | 					Object.defineProperty(root, k, | ||||||
|  | 						Object.getOwnPropertyDescriptor(cur, k)) }) | ||||||
|  | 			return root }, root) } | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| //---------------------------------------------------------------------
 | //---------------------------------------------------------------------
 | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "ig-object", |   "name": "ig-object", | ||||||
|   "version": "1.3.0", |   "version": "1.4.0", | ||||||
|   "description": "", |   "description": "", | ||||||
|   "main": "object.js", |   "main": "object.js", | ||||||
|   "scripts": { |   "scripts": { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user