mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			21 lines
		
	
	
		
			620 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			620 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| 'use strict';
 | |
| 
 | |
| const NotFoundError = require('../../lib/error/notfound-error');
 | |
| 
 | |
| module.exports = () => {
 | |
|     const _strategies = [{ name: 'default', editable: false, parameters: {} }];
 | |
| 
 | |
|     return {
 | |
|         getStrategies: () => Promise.resolve(_strategies),
 | |
|         getStrategy: name => {
 | |
|             const strategy = _strategies.find(s => s.name === name);
 | |
|             if (strategy) {
 | |
|                 return Promise.resolve(strategy);
 | |
|             } else {
 | |
|                 return Promise.reject(new NotFoundError('Not found!'));
 | |
|             }
 | |
|         },
 | |
|         addStrategy: strat => _strategies.push(strat),
 | |
|     };
 | |
| };
 |