mirror of https://github.com/Seich/Beau.git
				
				
				
			
		
			
				
	
	
		
			29 lines
		
	
	
		
			550 B
		
	
	
	
		
			JavaScript
		
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			550 B
		
	
	
	
		
			JavaScript
		
	
	
	
| const RequestList = require('./requestList');
 | |
| 
 | |
| class Beau {
 | |
| 	constructor(doc) {
 | |
| 		this.defaults = {
 | |
| 			VERSION: 1,
 | |
| 			CACHE: false,
 | |
| 			HOST: ''
 | |
| 		};
 | |
| 
 | |
| 		this.configKeys = Object.keys(this.defaults);
 | |
| 		this.config = this.loadConfig(doc, this.defaults);
 | |
| 		this.requests = new RequestList(doc, this.config);
 | |
| 	}
 | |
| 
 | |
| 	loadConfig(doc, defaults = {}) {
 | |
| 		var result = defaults;
 | |
| 
 | |
| 		Object.keys(doc)
 | |
| 			.filter(k => this.configKeys.indexOf(k.toUpperCase()) > -1)
 | |
| 			.forEach(k => result[k.toUpperCase()] = doc[k]);
 | |
| 
 | |
| 		return result;
 | |
| 	}
 | |
| }
 | |
| 
 | |
| 
 | |
| module.exports = Beau;
 |