/**
 * Transforms names between cases.
 */ export class NameTransformer { param name returns public toCamelCase ( name ) { const split = name . split ( "-" ) ; return ( split [ 0 ] . toLowerCase ( ) + split . slice ( 1 ) . map ( ( part ) : string => part . substring ( 0 , 1 ) . toUpperCase ( ) + part . substring ( 1 ) . toLowerCase ( ) ) . join ( "" ) ) ; } param name returns public toPascalCase ( name ) { return name . split ( "-" ) . map ( ( part ) : string => part . substring ( 0 , 1 ) . toUpperCase ( ) + part . substring ( 1 ) . toLowerCase ( ) ) . join ( "" ) ; } /**
     * Transforms a camelCase name to dashed-case.
     */ public toDashedCase ( name ) { let output = "" ; let lastAdded = 0 ; for ( let i = 0 ; i < name . length ; i += 1 ) { if ( name [ i ] . toUpperCase ( ) === name [ i ] ) { output += `${ name . substring ( lastAdded , i ) . toLowerCase ( ) }-` ; lastAdded = i ; } } output += name . substring ( lastAdded ) . toLowerCase ( ) ; if ( output [ output . length - 1 ] === "-" ) { output = output . substring ( 0 , output . length - 1 ) ; } return output ; } }