lib/index.js
function getByFirstImage(file, attributes) {
  var $ = cheerio.load(file.contents.toString()),
    img = $('img').first(),
    obj = {};
  if (img.length) {
    _.forEach(attributes, function(attribute) {
      obj[attribute] = img.attr(attribute);
    });
    return obj;
  } else {
    return undefined;
  }
}
function getByFirstImage(file, attributes) {
  var $ = cheerio.load(file.contents.toString()),
    img = $('img').first(),
    obj = {};
  if (img.length) {
    _.forEach(attributes, function(attribute) {
      obj[attribute] = img.attr(attribute);
    });
    return obj;
  } else {
    return undefined;
  }
}
function getByFirstImage ( file , attributes ) { var $ = cheerio . load ( file . contents . toString ( ) ) , img = $ ( 'img' ) . first ( ) , obj = { } ; if ( img . length ) { _ . forEach ( attributes , function ( attribute ) { obj [ attribute ] = img . attr ( attribute ) ; } ) ; return obj ; } else { return undefined ; } }
retrieve cover from file object by extracting the first image

@param  {Object} file file object
@return {Object}       cover
retrieve cover from file object by extracting the first image