File

src/core/src/pipes/kebab-case.pipe.ts

Metadata

Name matKeyboardKebabCase

Methods

transform
transform(value: string)
Parameters :
Name Type Optional
value string No
Returns : string
import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
  name: 'matKeyboardKebabCase',
  pure: false
})
export class MatKeyboardKebabCasePipe implements PipeTransform {

  transform(value: string): string {
    return value.replace(/([a-z])([A-Z])/g, '$1-$2')
      .replace(/\s+/g, '-')
      .toLowerCase();
  }

}

result-matching ""

    No results matching ""