mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	- Adding, updating and renaming environments are meant to be enterprise only features, as such, this PR moves these operations out of this server - We still keep sortOrder updating, toggling on/off and getting one, getting all, so we can still work with environments in the OSS version as well. Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai> Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
		
			
				
	
	
		
			28 lines
		
	
	
		
			752 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			752 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| export const snakeCase = (input: string): string => {
 | |
|     const result = [];
 | |
|     const splitString = input.split('');
 | |
|     for (let i = 0; i < splitString.length; i++) {
 | |
|         const char = splitString[i];
 | |
|         if (i !== 0 && char.toLocaleUpperCase() === char) {
 | |
|             result.push('_', char.toLocaleLowerCase());
 | |
|         } else {
 | |
|             result.push(char.toLocaleLowerCase());
 | |
|         }
 | |
|     }
 | |
|     return result.join('');
 | |
| };
 | |
| 
 | |
| export const snakeCaseKeys = (obj: {
 | |
|     [index: string]: any;
 | |
| }): { [index: string]: any } => {
 | |
|     const objResult: { [index: string]: any } = {};
 | |
| 
 | |
|     Object.keys(obj).forEach((key) => {
 | |
|         const snakeCaseKey = snakeCase(key);
 | |
| 
 | |
|         objResult[snakeCaseKey] = obj[key];
 | |
|     });
 | |
| 
 | |
|     return objResult;
 | |
| };
 |