source: src/Clients/Angular/finki-chattery/src/app/shared-app/pipes/truncate.pipe.ts@ e6a6d9a

dev
Last change on this file since e6a6d9a was e6a6d9a, checked in by Стојков Марко <mst@…>, 3 years ago

Initialized FinkiChattery project

  • Property mode set to 100644
File size: 370 bytes
Line 
1import { Pipe, PipeTransform } from '@angular/core';
2
3@Pipe({
4 name: 'truncate'
5})
6export class TruncatePipe implements PipeTransform {
7 transform(value: string | null | undefined, limit = 25): string | null {
8 if (value) {
9 if (value.length <= limit) {
10 return value;
11 }
12
13 return `${value.substr(0, limit)}...`;
14 }
15
16 return null;
17 }
18}
Note: See TracBrowser for help on using the repository browser.