index.js
function etag (entity, options) {
  if (entity == null) {
    throw new TypeError('argument entity is required')
  }

  // support fs.Stats object
  var isStats = isstats(entity)
  var weak = options && typeof options.weak === 'boolean'
    ? options.weak
    : isStats

  // validate argument
  if (!isStats && typeof entity !== 'string' && !Buffer.isBuffer(entity)) {
    throw new TypeError('argument entity must be string, Buffer, or fs.Stats')
  }

  // generate entity tag
  var tag = isStats
    ? stattag(entity)
    : entitytag(entity)

  return weak
    ? 'W/' + tag
    : tag
}
function etag (entity, options) {
  if (entity == null) {
    throw new TypeError('argument entity is required')
  }

  // support fs.Stats object
  var isStats = isstats(entity)
  var weak = options && typeof options.weak === 'boolean'
    ? options.weak
    : isStats

  // validate argument
  if (!isStats && typeof entity !== 'string' && !Buffer.isBuffer(entity)) {
    throw new TypeError('argument entity must be string, Buffer, or fs.Stats')
  }

  // generate entity tag
  var tag = isStats
    ? stattag(entity)
    : entitytag(entity)

  return weak
    ? 'W/' + tag
    : tag
}
function etag ( entity , options ) { if ( entity == null ) { throw new TypeError ( 'argument entity is required' ) } // support fs.Stats object var isStats = isstats ( entity ) var weak = options && typeof options . weak === 'boolean' ? options . weak : isStats // validate argument if ( ! isStats && typeof entity !== 'string' && ! Buffer . isBuffer ( entity ) ) { throw new TypeError ( 'argument entity must be string, Buffer, or fs.Stats' ) } // generate entity tag var tag = isStats ? stattag ( entity ) : entitytag ( entity ) return weak ? 'W/' + tag : tag }
Create a simple ETag.

@param {string|Buffer|Stats} entity
@param {object} [options]
@param {boolean} [options.weak]
@return {String}
@public
Create a simple ETag .