This change adds: * an impure badge for Pipes that are marked as `pure: false` * a pipe specific overview that shows the syntax for using a pipe in a template. * an "input value" section describing the type of the value that the pipe expects. * a "pipe params" section describing any additional params that a pipe expects. PR Close #22702
		
			
				
	
	
		
			20 lines
		
	
	
		
			753 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			753 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| module.exports = function extractPipeParams(createDocMessage) {
 | |
|   return {
 | |
|     $runAfter: ['extractDecoratedClassesProcessor'],
 | |
|     $runBefore: ['docs-processed'],
 | |
|     $process(docs) {
 | |
|       docs.forEach(doc => {
 | |
|         if (doc.docType === 'pipe') {
 | |
|           const transformFn = doc.members && doc.members.find(member => member.name === 'transform');
 | |
|           if (!transformFn) {
 | |
|             throw new Error(createDocMessage('Missing `transform` method - pipes must implement PipeTransform interface', doc));
 | |
|           }
 | |
|           doc.pipeName = doc.pipeOptions.name.replace(/^["']|["']$/g, '');
 | |
|           doc.valueParam = transformFn.parameterDocs[0];
 | |
|           doc.pipeParams = transformFn.parameterDocs.slice(1);
 | |
|         }
 | |
|       });
 | |
|     }
 | |
|   };
 | |
| };
 |