import { Pipe, PipeTransform } from '@angular/core';
import { isString } from '@utils/common';

@Pipe({
  name: 'trim',
})
export class TrimPipe implements PipeTransform {
  transform(value: string, length: number = 15): any {
    if (isString(value) && value.length > 15 + 3) {
      return value.substr(0, length - 1) + '...';
    }
    return '';
  }
}
