Skip to content

item.categories are not optional #118

@jaredcat

Description

@jaredcat

My feed items do not have categories, and the docs list this as optional.

When running feed.xml():

TypeError: undefined is not an object (evaluating 'item.categories.forEach')
      at /node_modules/rss/lib/index.js:71:9
      at forEach (:1:21)
      at generateXML (/node_modules/rss/lib/index.js:63:5)
      at /node_modules/rss/lib/index.js:185:17

When I change node_modules/rss/lib/index.js:71 to:

item.categories?.forEach(function(category) {
            ifTruePush(category, item_values, { category: { _cdata: category } });
        });

I am able to generate the xml feed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions