Extra tasks support

This commit is contained in:
Jocelyn Badgley (Twipped) 2020-04-07 10:36:22 -07:00
parent 88a97ada56
commit cccdef2706

View File

@ -119,16 +119,20 @@ module.exports = exports = class Page extends File {
res[camelCased] = true;
return res;
}, {});
}
tasks () {
if (!isObject(this.tweets)) return [];
return Object.values(this.tweets)
const tasks = [];
if (isObject(this.tweets)) {
tasks.push(...(
Object.values(this.tweets)
.map((t) => t.media)
.flat()
.map((m) => ({ ...m, action: actions.fetch, output: m.output }));
.map((m) => ({ ...m, action: actions.fetch, output: m.output }))
));
}
if (this._tasks) tasks.push(...this._tasks);
return tasks;
}
};