| 
									
										
										
										
											2015-09-30 09:13:23 +01:00
										 |  |  | var _ = require('lodash'); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 10:27:11 +01:00
										 |  |  | module.exports = function extractDecoratedClassesProcessor(EXPORT_DOC_TYPES) { | 
					
						
							| 
									
										
										
										
											2015-09-30 09:13:23 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // Add the "directive" docType into those that can be exported from a module
 | 
					
						
							| 
									
										
										
										
											2016-09-09 10:27:11 +01:00
										 |  |  |   EXPORT_DOC_TYPES.push('directive', 'pipe'); | 
					
						
							| 
									
										
										
										
											2015-09-30 09:13:23 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |   return { | 
					
						
							|  |  |  |     $runAfter: ['processing-docs'], | 
					
						
							|  |  |  |     $runBefore: ['docs-processed'], | 
					
						
							| 
									
										
										
										
											2016-09-09 10:27:11 +01:00
										 |  |  |     decoratorTypes: ['Directive', 'Component', 'Pipe'], | 
					
						
							| 
									
										
										
										
											2015-09-30 09:13:23 +01:00
										 |  |  |     $process: function(docs) { | 
					
						
							|  |  |  |       var decoratorTypes = this.decoratorTypes; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       _.forEach(docs, function(doc) { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         _.forEach(doc.decorators, function(decorator) { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           if (decoratorTypes.indexOf(decorator.name) !== -1) { | 
					
						
							| 
									
										
										
										
											2016-09-09 10:27:11 +01:00
										 |  |  |             doc.docType = decorator.name.toLowerCase(); | 
					
						
							|  |  |  |             doc[doc.docType + 'Options'] = decorator.argumentInfo[0]; | 
					
						
							| 
									
										
										
										
											2015-09-30 09:13:23 +01:00
										 |  |  |           } | 
					
						
							|  |  |  |         }); | 
					
						
							|  |  |  |       }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       return docs; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   }; | 
					
						
							| 
									
										
										
										
											2016-09-08 13:27:24 -07:00
										 |  |  | }; |