export function domainify ( s ) { return s . toLowerCase ( ) . replace ( /[^a-z0-9-]/g , '-' ) . replace ( /^-+/ , '' ) . replace ( /-+$/ , '' ) ; } export function randomIdentifier ( length = 6 ) { const alphabet = '23456789qwertyuipasdfghjkzxcvbnm' ; let result = '' ; for ( let i = 0 ; i < length ; i ++ ) { const j = Math . floor ( Math . random ( ) * alphabet . length ) ; const c = alphabet . substr ( j , 1 ) ; result += c ; } return result ; } export function someRandomness ( ) { return [ randomIdentifier ( 2 ) , randomIdentifier ( 3 ) ] . join ( '-' ) ; }