Update utils.js
This commit is contained in:
		
							parent
							
								
									a501170cbf
								
							
						
					
					
						commit
						e11bc75391
					
				
							
								
								
									
										10
									
								
								src/utils.js
								
								
								
								
							
							
						
						
									
										10
									
								
								src/utils.js
								
								
								
								
							| 
						 | 
					@ -14,7 +14,7 @@ const utils = {}
 | 
				
			||||||
const defaultUserAgent =
 | 
					const defaultUserAgent =
 | 
				
			||||||
  'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36 Edg/79.0.309.71'
 | 
					  'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36 Edg/79.0.309.71'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
utils.loadConfig = function (config, options = {}) {
 | 
					utils.loadConfig = function (config) {
 | 
				
			||||||
  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.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' && typeof config.url !== 'string')
 | 
					  if (typeof config.url !== 'function' && typeof config.url !== 'string')
 | 
				
			||||||
| 
						 | 
					@ -26,10 +26,10 @@ utils.loadConfig = function (config, options = {}) {
 | 
				
			||||||
    throw new Error("The 'logo' property should return the function")
 | 
					    throw new Error("The 'logo' property should return the function")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const defaultConfig = {
 | 
					  const defaultConfig = {
 | 
				
			||||||
    days: options.days ? parseInt(options.days) : 1,
 | 
					    days: 1,
 | 
				
			||||||
    lang: options.lang || 'en',
 | 
					    lang: 'en',
 | 
				
			||||||
    delay: options.delay ? parseInt(options.delay) : 3000,
 | 
					    delay: 3000,
 | 
				
			||||||
    output: options.output || 'guide.xml',
 | 
					    output: 'guide.xml',
 | 
				
			||||||
    request: {
 | 
					    request: {
 | 
				
			||||||
      method: 'GET',
 | 
					      method: 'GET',
 | 
				
			||||||
      maxContentLength: 5 * 1024 * 1024,
 | 
					      maxContentLength: 5 * 1024 * 1024,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue