code: function getLeastRecentlyUsed(mainDoc, lastUsedDoc) {
    var digestsToLastUsed = getDigestsToLastUsed(mainDoc, lastUsedDoc);
  
    var min;
    var minDigest;
    Object.keys(digestsToLastUsed).forEach(function (digest) {
      var lastUsed = digestsToLastUsed[digest];
      if (typeof min === 'undefined' || min > lastUsed) {
        min = lastUsed;
        minDigest = digest;
      }
    });
    return minDigest;
  }
docs: Get the digest that's the least recently used. If a digest was used
  by more than one attachment, then favor the more recent usage date.