lib/identity.js
function _identity (ndate, nrandom, nchecksum, epoc) {
  // ms since EPOC (1 Jan 1970)
  var since = _getDateMillis(epoc);

  // Max of ndate
  if (since.length > ndate) {
    throw new Error('Date too big');
  }

  // Pad to ndate
  since = bitString.pad(since, ndate);

  // Add nrandom Random bits
  since += bitString.randomBits(nrandom);

  // Add checksum bits
  since += bitString.checksum(since, nchecksum);

  // Convert to BaseURL
  return baseURL.encode(since);
}
function _identity (ndate, nrandom, nchecksum, epoc) {
  // ms since EPOC (1 Jan 1970)
  var since = _getDateMillis(epoc);

  // Max of ndate
  if (since.length > ndate) {
    throw new Error('Date too big');
  }

  // Pad to ndate
  since = bitString.pad(since, ndate);

  // Add nrandom Random bits
  since += bitString.randomBits(nrandom);

  // Add checksum bits
  since += bitString.checksum(since, nchecksum);

  // Convert to BaseURL
  return baseURL.encode(since);
}
function _identity ( ndate , nrandom , nchecksum , epoc ) { // ms since EPOC (1 Jan 1970) var since = _getDateMillis ( epoc ) ; // Max of ndate if ( since . length > ndate ) { throw new Error ( 'Date too big' ) ; } // Pad to ndate since = bitString . pad ( since , ndate ) ; // Add nrandom Random bits since += bitString . randomBits ( nrandom ) ; // Add checksum bits since += bitString . checksum ( since , nchecksum ) ; // Convert to BaseURL return baseURL . encode ( since ) ; }
Build an identity function
@private
@param  {integer} ndate     Size of date bits
@param  {integer} nrandom   Size of random bits
@param  {integer} nchecksum Size of checksum bits
@param  {Date} epoc         Epoc to use
@return {string}            BaseURL encoded id
Build an identity function