export default { get : function ( name ) { let arr ; const reg = new RegExp ( '(^| )' + name + '=([^;]*)(;|$)' ) ; if ( ( arr = document . cookie . match ( reg ) ) ) return decodeURIComponent ( arr [ 2 ] ) ; else return null ; } , set : function ( name , value , time ) { const exp = new Date ( ) ; exp . setTime ( exp . getTime ( ) + time * 1000 ) ; document . cookie = name + '=' + encodeURI ( value ) + ';expires=' + exp . toUTCString ( ) + ';path=/' ; } , remove : function ( name ) { const exp = new Date ( ) ; exp . setTime ( exp . getTime ( ) - 1 ) ; if ( this . get ( name ) != null ) document . cookie = name + '=' + this . get ( name ) + ';expires=' + exp . toUTCString ( ) ; } , } ;