import { Pipe , PipeTransform } from '@angular/core' ; type ClassAttr = string | string [ ] ; @ Pipe ( { name : 'kebab' } ) export class KebabPipe implements PipeTransform { replace ( s ) { return s . toLowerCase ( ) . replace ( / /g , '-' ) ; } transform ( value ) { return Array . isArray ( value ) ? value . map ( s => this . replace ( s ) ) : this . replace ( value ) ; } }