| 
									
										
										
										
											2021-02-16 14:00:24 +07:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @license | 
					
						
							|  |  |  |  * Copyright Google LLC All Rights Reserved. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Use of this source code is governed by an MIT-style license that can be | 
					
						
							|  |  |  |  * found in the LICENSE file at https://angular.io/license
 | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2021-05-22 12:50:10 +01:00
										 |  |  | // #docregion
 | 
					
						
							| 
									
										
										
										
											2021-02-16 14:00:24 +07:00
										 |  |  | import {Pipe, PipeTransform} from '@angular/core'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @Pipe({name: 'truncate'}) | 
					
						
							|  |  |  | export class TruncatePipe implements PipeTransform { | 
					
						
							| 
									
										
										
										
											2021-05-22 12:50:10 +01:00
										 |  |  |   transform(value: string, length: number, symbol: string) { | 
					
						
							| 
									
										
										
										
											2021-02-16 14:00:24 +07:00
										 |  |  |     return value.split(' ').slice(0, length).join(' ') + symbol; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } |