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

  var setCategory = function (category, attrProp) {
    if (!category) {
      return;
    } else if (attrProp) {
      category = utils.getAttr(category, attrProp);
    }

    if (!categoryMap[category]) {
      categoryMap[category] = true;
    }
  };

  var splitAndSetCategory = function (category, delimiter) {
    category && category.split(delimiter).forEach(function (cat) {
      setCategory(cat);
    });
  };

  ['category', 'dc:subject', 'itunes:category', 'media:category'].forEach(function (key) {
    if (!node[key]) {
      return;
    }

    utils.parse(node[key], function (category) {
      if (key === 'category') {
        setCategory.apply(null, (feedType === 'atom' ? [category, 'term'] : [utils.get(category)]));
      } else if (key === 'dc:subject') {
        splitAndSetCategory(utils.get(category), ' ');
      } else if (key === 'itunes:category') {
        //sometimes itunes:category has it's own itunes:category property
        setCategory(category, 'text');
        utils.parse(category[key] || category, function (cat) {
          setCategory(cat, 'text');
        });
      } else if (key === 'media:category') {
        splitAndSetCategory(utils.get(category), '/');
      }
    });
  });

  var categories = Object.keys(categoryMap);

  return categories.length && categories.map(function (key) {
    return key;
  });
}
function parseCategories (node, nodeType, feedType) {
  var categoryMap = {};

  var setCategory = function (category, attrProp) {
    if (!category) {
      return;
    } else if (attrProp) {
      category = utils.getAttr(category, attrProp);
    }

    if (!categoryMap[category]) {
      categoryMap[category] = true;
    }
  };

  var splitAndSetCategory = function (category, delimiter) {
    category && category.split(delimiter).forEach(function (cat) {
      setCategory(cat);
    });
  };

  ['category', 'dc:subject', 'itunes:category', 'media:category'].forEach(function (key) {
    if (!node[key]) {
      return;
    }

    utils.parse(node[key], function (category) {
      if (key === 'category') {
        setCategory.apply(null, (feedType === 'atom' ? [category, 'term'] : [utils.get(category)]));
      } else if (key === 'dc:subject') {
        splitAndSetCategory(utils.get(category), ' ');
      } else if (key === 'itunes:category') {
        //sometimes itunes:category has it's own itunes:category property
        setCategory(category, 'text');
        utils.parse(category[key] || category, function (cat) {
          setCategory(cat, 'text');
        });
      } else if (key === 'media:category') {
        splitAndSetCategory(utils.get(category), '/');
      }
    });
  });

  var categories = Object.keys(categoryMap);

  return categories.length && categories.map(function (key) {
    return key;
  });
}
function parseCategories ( node , nodeType , feedType ) { var categoryMap = { } ; var setCategory = function ( category , attrProp ) { if ( ! category ) { return ; } else if ( attrProp ) { category = utils . getAttr ( category , attrProp ) ; } if ( ! categoryMap [ category ] ) { categoryMap [ category ] = true ; } } ; var splitAndSetCategory = function ( category , delimiter ) { category && category . split ( delimiter ) . forEach ( function ( cat ) { setCategory ( cat ) ; } ) ; } ; [ 'category' , 'dc:subject' , 'itunes:category' , 'media:category' ] . forEach ( function ( key ) { if ( ! node [ key ] ) { return ; } utils . parse ( node [ key ] , function ( category ) { if ( key === 'category' ) { setCategory . apply ( null , ( feedType === 'atom' ? [ category , 'term' ] : [ utils . get ( category ) ] ) ) ; } else if ( key === 'dc:subject' ) { splitAndSetCategory ( utils . get ( category ) , ' ' ) ; } else if ( key === 'itunes:category' ) { //sometimes itunes:category has it's own itunes:category property setCategory ( category , 'text' ) ; utils . parse ( category [ key ] || category , function ( cat ) { setCategory ( cat , 'text' ) ; } ) ; } else if ( key === 'media:category' ) { splitAndSetCategory ( utils . get ( category ) , '/' ) ; } } ) ; } ) ; var categories = Object . keys ( categoryMap ) ; return categories . length && categories . map ( function ( key ) { return key ; } ) ; }
Parses and aggregates an Array of categories for an item or meta node.  The following node properties are parsed in
order of most frequently available.  Categories for a specific node are uniquely identified and cached by value,
then mapped to an array of categories

category, dc:subject, link, itunes:category, media:category

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