index.js
function iconLookup(filename) {
  var ext = extname(filename);

  // try by extension
  if (icons[ext]) {
    return {
      className: 'icon-' + ext.substring(1),
      fileName: icons[ext]
    };
  }

  var mimetype = mime.lookup(ext);

  // default if no mime type
  if (mimetype === false) {
    return {
      className: 'icon-default',
      fileName: icons.default
    };
  }

  // try by mime type
  if (icons[mimetype]) {
    return {
      className: 'icon-' + mimetype.replace('/', '-'),
      fileName: icons[mimetype]
    };
  }

  var suffix = mimetype.split('+')[1];

  if (suffix && icons['+' + suffix]) {
    return {
      className: 'icon-' + suffix,
      fileName: icons['+' + suffix]
    };
  }

  var type = mimetype.split('/')[0];

  // try by type only
  if (icons[type]) {
    return {
      className: 'icon-' + type,
      fileName: icons[type]
    };
  }

  return {
    className: 'icon-default',
    fileName: icons.default
  };
}
function iconLookup(filename) {
  var ext = extname(filename);

  // try by extension
  if (icons[ext]) {
    return {
      className: 'icon-' + ext.substring(1),
      fileName: icons[ext]
    };
  }

  var mimetype = mime.lookup(ext);

  // default if no mime type
  if (mimetype === false) {
    return {
      className: 'icon-default',
      fileName: icons.default
    };
  }

  // try by mime type
  if (icons[mimetype]) {
    return {
      className: 'icon-' + mimetype.replace('/', '-'),
      fileName: icons[mimetype]
    };
  }

  var suffix = mimetype.split('+')[1];

  if (suffix && icons['+' + suffix]) {
    return {
      className: 'icon-' + suffix,
      fileName: icons['+' + suffix]
    };
  }

  var type = mimetype.split('/')[0];

  // try by type only
  if (icons[type]) {
    return {
      className: 'icon-' + type,
      fileName: icons[type]
    };
  }

  return {
    className: 'icon-default',
    fileName: icons.default
  };
}
function iconLookup ( filename ) { var ext = extname ( filename ) ; // try by extension if ( icons [ ext ] ) { return { className : 'icon-' + ext . substring ( 1 ) , fileName : icons [ ext ] } ; } var mimetype = mime . lookup ( ext ) ; // default if no mime type if ( mimetype === false ) { return { className : 'icon-default' , fileName : icons . default } ; } // try by mime type if ( icons [ mimetype ] ) { return { className : 'icon-' + mimetype . replace ( '/' , '-' ) , fileName : icons [ mimetype ] } ; } var suffix = mimetype . split ( '+' ) [ 1 ] ; if ( suffix && icons [ '+' + suffix ] ) { return { className : 'icon-' + suffix , fileName : icons [ '+' + suffix ] } ; } var type = mimetype . split ( '/' ) [ 0 ] ; // try by type only if ( icons [ type ] ) { return { className : 'icon-' + type , fileName : icons [ type ] } ; } return { className : 'icon-default' , fileName : icons . default } ; }
Get the icon data for the file name.
Get the icon data for the file name .