index.js
function populateMaps (extensions, types) {
  // source preference (least -> most)
  var preference = ['nginx', 'apache', undefined, 'iana']

  Object.keys(db).forEach(function forEachMimeType (type) {
    var mime = db[type]
    var exts = mime.extensions

    if (!exts || !exts.length) {
      return
    }

    // mime -> extensions
    extensions[type] = exts

    // extension -> mime
    for (var i = 0; i < exts.length; i++) {
      var extension = exts[i]

      if (types[extension]) {
        var from = preference.indexOf(db[types[extension]].source)
        var to = preference.indexOf(mime.source)

        if (types[extension] !== 'application/octet-stream' &&
          (from > to || (from === to && types[extension].substr(0, 12) === 'application/'))) {
          // skip the remapping
          continue
        }
      }

      // set the extension -> mime
      types[extension] = type
    }
  })
}
function populateMaps (extensions, types) {
  // source preference (least -> most)
  var preference = ['nginx', 'apache', undefined, 'iana']

  Object.keys(db).forEach(function forEachMimeType (type) {
    var mime = db[type]
    var exts = mime.extensions

    if (!exts || !exts.length) {
      return
    }

    // mime -> extensions
    extensions[type] = exts

    // extension -> mime
    for (var i = 0; i < exts.length; i++) {
      var extension = exts[i]

      if (types[extension]) {
        var from = preference.indexOf(db[types[extension]].source)
        var to = preference.indexOf(mime.source)

        if (types[extension] !== 'application/octet-stream' &&
          (from > to || (from === to && types[extension].substr(0, 12) === 'application/'))) {
          // skip the remapping
          continue
        }
      }

      // set the extension -> mime
      types[extension] = type
    }
  })
}
function populateMaps ( extensions , types ) { // source preference (least -> most) var preference = [ 'nginx' , 'apache' , undefined , 'iana' ] Object . keys ( db ) . forEach ( function forEachMimeType ( type ) { var mime = db [ type ] var exts = mime . extensions if ( ! exts || ! exts . length ) { return } // mime -> extensions extensions [ type ] = exts // extension -> mime for ( var i = 0 ; i < exts . length ; i ++ ) { var extension = exts [ i ] if ( types [ extension ] ) { var from = preference . indexOf ( db [ types [ extension ] ] . source ) var to = preference . indexOf ( mime . source ) if ( types [ extension ] !== 'application/octet-stream' && ( from > to || ( from === to && types [ extension ] . substr ( 0 , 12 ) === 'application/' ) ) ) { // skip the remapping continue } } // set the extension -> mime types [ extension ] = type } } ) }
Populate the extensions and types maps.
@private
Populate the extensions and types maps .