Add unique function (#2644)
This commit is contained in:
		
							parent
							
								
									e34b264af2
								
							
						
					
					
						commit
						ff0a05a2d6
					
				
					 2 changed files with 10 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -17,3 +17,7 @@ export function intersperse<T>(sep: T, xs: T[]): T[] {
 | 
			
		|||
export function erase<T>(x: T, xs: T[]): T[] {
 | 
			
		||||
	return xs.filter(y => x !== y);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function unique<T>(xs: T[]): T[] {
 | 
			
		||||
	return [...new Set(xs)];
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue