mirror of
				https://github.com/Instadapp/trustwallet-assets.git
				synced 2024-07-29 22:37:31 +00:00 
			
		
		
		
	 63c1dcaf1a
			
		
	
	
		63c1dcaf1a
		
			
		
	
	
	
	
		
			
			* Add check for tags field (array) * Lint fix * Using reduce() instead of forEach() for checking all values Co-authored-by: Catenocrypt <catenocrypt@users.noreply.github.com>
		
			
				
	
	
		
			20 lines
		
	
	
		
			549 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			549 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { readJsonFile } from "../generic/json";
 | |
| 
 | |
| const tags: any = readJsonFile("script/tags.json") as any;
 | |
| 
 | |
| export function isValidTagValue(value: string): boolean {
 | |
|     //console.log(`isValidTagValue ${value}`);
 | |
|     if (!value) {
 | |
|         return false;
 | |
|     }
 | |
|     if (!(value in tags)) {
 | |
|         return false;
 | |
|     }
 | |
|     //console.log(`TAG ${tags[value]['name']}`);
 | |
|     return true;
 | |
| }
 | |
| 
 | |
| export function isValidTagValues(values: string[]): boolean {
 | |
|     return values.reduce((accum: boolean, value: string) => accum && isValidTagValue(value), true);
 | |
| }
 |