src/index.js
function get(key, decoder = decodeURIComponent) {
  if ((typeof key !== 'string') || !key) {
    return null;
  }

  const reKey = new RegExp(`(?:^|; )${escapeRe(key)}(?:=([^;]*))?(?:;|$)`);
  const match = reKey.exec(document.cookie);

  if (match === null) {
    return null;
  }

  return typeof decoder === 'function' ? decoder(match[1]) : match[1];
}
function get(key, decoder = decodeURIComponent) {
  if ((typeof key !== 'string') || !key) {
    return null;
  }

  const reKey = new RegExp(`(?:^|; )${escapeRe(key)}(?:=([^;]*))?(?:;|$)`);
  const match = reKey.exec(document.cookie);

  if (match === null) {
    return null;
  }

  return typeof decoder === 'function' ? decoder(match[1]) : match[1];
}
function get ( key , decoder = decodeURIComponent ) { if ( ( typeof key !== 'string' ) || ! key ) { return null ; } const reKey = new RegExp ( ` ${ escapeRe ( key ) } ` ) ; const match = reKey . exec ( document . cookie ) ; if ( match === null ) { return null ; } return typeof decoder === 'function' ? decoder ( match [ 1 ] ) : match [ 1 ] ; }
Get the cookie value by key.
Get the cookie value by key .