You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					17 lines
				
				390 B
			
		
		
			
		
	
	
					17 lines
				
				390 B
			| 
											2 years ago
										 | var Traverse = require('traverse'); | ||
|  | 
 | ||
|  | var id = 54; | ||
|  | var callbacks = {}; | ||
|  | var obj = { moo : function () {}, foo : [2,3,4, function () {}] }; | ||
|  | 
 | ||
|  | var scrubbed = Traverse(obj).map(function (x) { | ||
|  |     if (typeof x === 'function') { | ||
|  |         callbacks[id] = { id : id, f : x, path : this.path }; | ||
|  |         this.update('[Function]'); | ||
|  |         id++; | ||
|  |     } | ||
|  | }); | ||
|  | 
 | ||
|  | console.dir(scrubbed); | ||
|  | console.dir(callbacks); |