export function getCookie ( name ) { const dc = document . cookie ; const prefix = name + '=' ; let begin = dc . indexOf ( '; ' + prefix ) ; let end = undefined ; if ( begin === - 1 ) { begin = dc . indexOf ( prefix ) ; if ( begin !== 0 ) { return undefined ; } } else { begin += 2 ; end = document . cookie . indexOf ( ';' , begin ) ; if ( end === - 1 ) { end = dc . length ; } } return decodeURI ( dc . substring ( begin + prefix . length , end ) ) ; }