index.js
function decode(cache, API_URL, str) {
  var cached = cache.get(str);
  if (typeof cached !== 'undefined') return cached;
  if (typeof str !== 'string') return null;

  var decoded = base64.decode(str).toString().replace(/\0/g, '');

  var out = validate(decoded) ?
    {href: unpack(decoded, API_URL)} :
    str;

  // cache the decoded value since this ends up being pretty expensive
  cache.set(str, out);

  return out;
}
function decode(cache, API_URL, str) {
  var cached = cache.get(str);
  if (typeof cached !== 'undefined') return cached;
  if (typeof str !== 'string') return null;

  var decoded = base64.decode(str).toString().replace(/\0/g, '');

  var out = validate(decoded) ?
    {href: unpack(decoded, API_URL)} :
    str;

  // cache the decoded value since this ends up being pretty expensive
  cache.set(str, out);

  return out;
}
function decode ( cache , API_URL , str ) { var cached = cache . get ( str ) ; if ( typeof cached !== 'undefined' ) return cached ; if ( typeof str !== 'string' ) return null ; var decoded = base64 . decode ( str ) . toString ( ) . replace ( / \0 / g , '' ) ; var out = validate ( decoded ) ? { href : unpack ( decoded , API_URL ) } : str ; // cache the decoded value since this ends up being pretty expensive cache . set ( str , out ) ; return out ; }
Decode an encoded uri component
Decode an encoded uri component