mirror of
				https://github.com/flynx/features.js.git
				synced 2025-10-31 03:10:09 +00:00 
			
		
		
		
	added experimental graphviz graph generator...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									e50f1ccaef
								
							
						
					
					
						commit
						c56d8e1caf
					
				
							
								
								
									
										23
									
								
								features.js
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								features.js
									
									
									
									
									
								
							| @ -1027,6 +1027,29 @@ var FeatureSetProto = { | |||||||
| 		}) | 		}) | ||||||
| 	}, | 	}, | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | 	// Generate a Graphviz graph from features...
 | ||||||
|  | 	//
 | ||||||
|  | 	// XXX experimental...
 | ||||||
|  | 	gvGraph: function(lst, dep){ | ||||||
|  | 		lst = lst || this.features | ||||||
|  | 		dep = dep || this | ||||||
|  | 
 | ||||||
|  | 		var graph = '' | ||||||
|  | 		graph += 'digraph ImageGrid {\n' | ||||||
|  | 		lst.forEach(function(f){ | ||||||
|  | 			var deps = dep[f] || [] | ||||||
|  | 
 | ||||||
|  | 			deps.length > 0 ? | ||||||
|  | 				deps.forEach(function(d){ | ||||||
|  | 					graph += `\t"${f}" -> "${d}";\n` }) | ||||||
|  | 				: (graph += `\t"${f}";\n`) | ||||||
|  | 		}) | ||||||
|  | 		graph += '}' | ||||||
|  | 
 | ||||||
|  | 		return graph | ||||||
|  | 	}, | ||||||
|  | 
 | ||||||
| 	// shorthand for: Feature(<feature-set>, ...)
 | 	// shorthand for: Feature(<feature-set>, ...)
 | ||||||
| 	Feature: function(){ | 	Feature: function(){ | ||||||
| 		return this.__feature__.apply(null, [this].concat(args2array(arguments))) }, | 		return this.__feature__.apply(null, [this].concat(args2array(arguments))) }, | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "ig-features", |   "name": "ig-features", | ||||||
|   "version": "3.2.2", |   "version": "3.2.3", | ||||||
|   "description": "", |   "description": "", | ||||||
|   "main": "features.js", |   "main": "features.js", | ||||||
|   "scripts": { |   "scripts": { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user