Skip to content

Commit

Permalink
fix(lastmod): undefined options
Browse files Browse the repository at this point in the history
  • Loading branch information
nunof07 committed Apr 28, 2021
1 parent 153853c commit 63f1e83
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/lastmod.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
const sitemapDateTime = require("./sitemapDateTime");
const sitemapProperty = require("./sitemapProperty");

module.exports = (item, { lastModifiedProperty }) =>
sitemapProperty(item, "lastmod") ||
(lastModifiedProperty &&
item.data &&
item.data[lastModifiedProperty] &&
sitemapDateTime(item.data[lastModifiedProperty])) ||
sitemapDateTime(item.date);
module.exports = (item, options) => {
const lastModifiedProperty = options && options.lastModifiedProperty;

return (
sitemapProperty(item, "lastmod") ||
(lastModifiedProperty &&
item.data &&
item.data[lastModifiedProperty] &&
sitemapDateTime(item.data[lastModifiedProperty])) ||
sitemapDateTime(item.date)
);
};

0 comments on commit 63f1e83

Please sign in to comment.