The url property could be type of string
This commit is contained in:
parent
13ce560427
commit
6860beba28
|
@ -33,7 +33,7 @@ async function main() {
|
||||||
let programs = []
|
let programs = []
|
||||||
console.log('Parsing:')
|
console.log('Parsing:')
|
||||||
for (let item of queue) {
|
for (let item of queue) {
|
||||||
const url = config.url(item)
|
const url = typeof config.url === 'function' ? config.url(item) : config.url
|
||||||
if (options.debug) console.time(' time')
|
if (options.debug) console.time(' time')
|
||||||
const progs = await client
|
const progs = await client
|
||||||
.get(url)
|
.get(url)
|
||||||
|
|
|
@ -21,8 +21,8 @@ utils.loadConfig = function (file) {
|
||||||
if (!config.site) throw new Error("The required 'site' property is missing")
|
if (!config.site) throw new Error("The required 'site' property is missing")
|
||||||
if (!config.channels) throw new Error("The required 'channels' property is missing")
|
if (!config.channels) throw new Error("The required 'channels' property is missing")
|
||||||
if (!config.url) throw new Error("The required 'url' property is missing")
|
if (!config.url) throw new Error("The required 'url' property is missing")
|
||||||
if (typeof config.url !== 'function')
|
if (typeof config.url !== 'function' && typeof config.url !== 'string')
|
||||||
throw new Error("The 'url' property should return the function")
|
throw new Error("The 'url' property should return the function or string")
|
||||||
if (!config.parser) throw new Error("The required 'parser' function is missing")
|
if (!config.parser) throw new Error("The required 'parser' function is missing")
|
||||||
if (typeof config.parser !== 'function')
|
if (typeof config.parser !== 'function')
|
||||||
throw new Error("The 'parser' property should return the function")
|
throw new Error("The 'parser' property should return the function")
|
||||||
|
|
Loading…
Reference in New Issue