param revision returns export function shortenRevision ( revision = '' ) { if ( revision . includes ( '/' ) ) { const [ gitBranch , gitRevision ] = revision . split ( '/' ) ; return [ gitBranch , '/' , gitRevision . slice ( 0 , 7 ) ] . join ( '' ) ; } else { return revision . slice ( 0 , 7 ) ; } } param str export function sanitizeRFC1123 ( str ) { const notAllowedSymbolsRegex = /[^a-z0-9.-]/g ; const notAllowedSymbolsAtTheStartRegex = /^[^a-z0-9]+/ ; const notAllowedSymbolsAtTheEndRegex = /[^a-z0-9]+$/ ; const lowercaseString = str . toLocaleLowerCase ( ) ; const sanitizedString = lowercaseString . replace ( notAllowedSymbolsRegex , '' ) . replace ( notAllowedSymbolsAtTheStartRegex , '' ) . replace ( notAllowedSymbolsAtTheEndRegex , '' ) ; return truncateString ( sanitizedString , 253 ) ; } param str param maxChars export function truncateString ( str , maxChars ) { const chars = [ ... str ] ; return chars . length > maxChars ? chars . slice ( 0 , maxChars ) . join ( '' ) : str ; }