import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'trucateWords',
})
export class TrucateWordsPipe implements PipeTransform {
transform(value: string, limit: number = 20): string {
if (!value) return value;
const words = value.split(' ');
return words.length > limit
? words.slice(0, limit).join(' ') + '...'
: value;
}
}