index.js
function createSetHeader (options) {
  // response time digits
  var digits = options.digits !== undefined
    ? options.digits
    : 3

  // header name
  var header = options.header || 'X-Response-Time'

  // display suffix
  var suffix = options.suffix !== undefined
    ? Boolean(options.suffix)
    : true

  return function setResponseHeader (req, res, time) {
    if (res.getHeader(header)) {
      return
    }

    var val = time.toFixed(digits)

    if (suffix) {
      val += 'ms'
    }

    res.setHeader(header, val)
  }
}
function createSetHeader (options) {
  // response time digits
  var digits = options.digits !== undefined
    ? options.digits
    : 3

  // header name
  var header = options.header || 'X-Response-Time'

  // display suffix
  var suffix = options.suffix !== undefined
    ? Boolean(options.suffix)
    : true

  return function setResponseHeader (req, res, time) {
    if (res.getHeader(header)) {
      return
    }

    var val = time.toFixed(digits)

    if (suffix) {
      val += 'ms'
    }

    res.setHeader(header, val)
  }
}
function createSetHeader ( options ) { // response time digits var digits = options . digits !== undefined ? options . digits : 3 // header name var header = options . header || 'X-Response-Time' // display suffix var suffix = options . suffix !== undefined ? Boolean ( options . suffix ) : true return function setResponseHeader ( req , res , time ) { if ( res . getHeader ( header ) ) { return } var val = time . toFixed ( digits ) if ( suffix ) { val += 'ms' } res . setHeader ( header , val ) } }
Create function to set respoonse time header.
@private
Create function to set respoonse time header .