diff options
author | Doge Gui <[email protected]> | 2022-01-16 20:23:58 +0800 |
---|---|---|
committer | Doge Gui <[email protected]> | 2022-01-16 20:23:58 +0800 |
commit | def02895045d3def6fb8dbd1a4d3a6948979c8ed (patch) | |
tree | 9673e25285bed212b7c7a7604b5c2d85e986014a | |
parent | 9b2343ad72cbf9e798c249d959d370317caccfe9 (diff) | |
download | chromate-def02895045d3def6fb8dbd1a4d3a6948979c8ed.tar.gz chromate-def02895045d3def6fb8dbd1a4d3a6948979c8ed.tar.bz2 chromate-def02895045d3def6fb8dbd1a4d3a6948979c8ed.zip |
Check constructor
-rw-r--r-- | scripts/feed.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/scripts/feed.js b/scripts/feed.js index edecc99..1dc4300 100644 --- a/scripts/feed.js +++ b/scripts/feed.js @@ -1,5 +1,3 @@ -'use strict'; - hexo.extend.generator.register("feed", (locals) => { // Load config @@ -10,8 +8,11 @@ hexo.extend.generator.register("feed", (locals) => { const hstrip = hexo.extend.helper.get("strip_html").bind(hexo); if (!theme.rss || !theme.rss.enable) return; - const podcast = require("podcast"); - if (podcast.hasOwnProperty('Podcast')) + let podcast = require("podcast"); + function is_constructor(obj) { + return !!obj.prototype && !!obj.prototype.constructor.name; + } + if (!is_constructor(podcast)) podcast = podcast.Podcast; // Generate Podcast Categories content |