index.js
function encode(cache, API_URL, obj) {
  if (!obj) return null;
  if (!obj.href) return obj;

  var href = API_URL ?
    pack(obj.href, API_URL) :
    obj.href;

  var cached = cache.get(href);
  if (cached) return cached;

  var encoded = base64.encode(new Buffer(href)).toString();
  cache.set(href, encoded);
  return encoded;
}
function encode(cache, API_URL, obj) {
  if (!obj) return null;
  if (!obj.href) return obj;

  var href = API_URL ?
    pack(obj.href, API_URL) :
    obj.href;

  var cached = cache.get(href);
  if (cached) return cached;

  var encoded = base64.encode(new Buffer(href)).toString();
  cache.set(href, encoded);
  return encoded;
}
function encode ( cache , API_URL , obj ) { if ( ! obj ) return null ; if ( ! obj . href ) return obj ; var href = API_URL ? pack ( obj . href , API_URL ) : obj . href ; var cached = cache . get ( href ) ; if ( cached ) return cached ; var encoded = base64 . encode ( new Buffer ( href ) ) . toString ( ) ; cache . set ( href , encoded ) ; return encoded ; }
Encode an href object
Encode an href object