lib/parser.js
function parseEnclosures (node, nodeType, feedType) {
  var enclosuresMap = {};

  ['media:content', 'enclosure', 'link', 'enc:enclosure'].forEach(function (key) {
    if (!node[key]) {
      return;
    }

    utils.parse(node[key], function (enc) {
      var enclosure,
          encAttr = enc['@'];

      if (!encAttr) {
        return;
      }

      switch(key) {
        case('media:content'):
          enclosure = createEnclosure(encAttr.url, encAttr.type || encAttr.medium, encAttr.filesize);
          break;
        case('enclosure'):
          enclosure = createEnclosure(encAttr.url, encAttr.type, encAttr.length);
          break;
        case('link'):
          if (encAttr.rel === 'enclosure' && encAttr.href) {
            enclosure = createEnclosure(encAttr.href, encAttr.type, encAttr.length);
          }
          break;
        case('enc:enclosure'):
          enclosure = createEnclosure(encAttr.url || encAttr['rdf:resource'], encAttr.type, encAttr.length);
          break;
      }

      if (enclosure) {
        enclosuresMap[enclosure.url] = enclosure;
      }
    });
  });

  var enclosures = Object.keys(enclosuresMap);

  return enclosures.length && enclosures.map(function (key) {
    return enclosuresMap[key];
  });
}
function parseEnclosures (node, nodeType, feedType) {
  var enclosuresMap = {};

  ['media:content', 'enclosure', 'link', 'enc:enclosure'].forEach(function (key) {
    if (!node[key]) {
      return;
    }

    utils.parse(node[key], function (enc) {
      var enclosure,
          encAttr = enc['@'];

      if (!encAttr) {
        return;
      }

      switch(key) {
        case('media:content'):
          enclosure = createEnclosure(encAttr.url, encAttr.type || encAttr.medium, encAttr.filesize);
          break;
        case('enclosure'):
          enclosure = createEnclosure(encAttr.url, encAttr.type, encAttr.length);
          break;
        case('link'):
          if (encAttr.rel === 'enclosure' && encAttr.href) {
            enclosure = createEnclosure(encAttr.href, encAttr.type, encAttr.length);
          }
          break;
        case('enc:enclosure'):
          enclosure = createEnclosure(encAttr.url || encAttr['rdf:resource'], encAttr.type, encAttr.length);
          break;
      }

      if (enclosure) {
        enclosuresMap[enclosure.url] = enclosure;
      }
    });
  });

  var enclosures = Object.keys(enclosuresMap);

  return enclosures.length && enclosures.map(function (key) {
    return enclosuresMap[key];
  });
}
function parseEnclosures ( node , nodeType , feedType ) { var enclosuresMap = { } ; [ 'media:content' , 'enclosure' , 'link' , 'enc:enclosure' ] . forEach ( function ( key ) { if ( ! node [ key ] ) { return ; } utils . parse ( node [ key ] , function ( enc ) { var enclosure , encAttr = enc [ '@' ] ; if ( ! encAttr ) { return ; } switch ( key ) { case ( 'media:content' ) : enclosure = createEnclosure ( encAttr . url , encAttr . type || encAttr . medium , encAttr . filesize ) ; break ; case ( 'enclosure' ) : enclosure = createEnclosure ( encAttr . url , encAttr . type , encAttr . length ) ; break ; case ( 'link' ) : if ( encAttr . rel === 'enclosure' && encAttr . href ) { enclosure = createEnclosure ( encAttr . href , encAttr . type , encAttr . length ) ; } break ; case ( 'enc:enclosure' ) : enclosure = createEnclosure ( encAttr . url || encAttr [ 'rdf:resource' ] , encAttr . type , encAttr . length ) ; break ; } if ( enclosure ) { enclosuresMap [ enclosure . url ] = enclosure ; } } ) ; } ) ; var enclosures = Object . keys ( enclosuresMap ) ; return enclosures . length && enclosures . map ( function ( key ) { return enclosuresMap [ key ] ; } ) ; }
Parses and aggregates an Array of enclosures for an item node.  The following node properties are parsed in
order of most frequently available.  enclosures for a specific node are uniquely identified and cached by url,
then mapped to an array of enclosures

media:content, enclosure, link, enc:enclosure

@param node
@param nodeType
@param feedType
@returns {Array}
Parses and aggregates an Array of enclosures for an item node . The following node properties are parsed in order of most frequently available . enclosures for a specific node are uniquely identified and cached by url then mapped to an array of enclosures