mirror of
				https://github.com/datahub-project/datahub.git
				synced 2025-11-04 04:39:10 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			13 lines
		
	
	
		
			429 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			13 lines
		
	
	
		
			429 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
/**
 | 
						|
 * Matches an a string to an email pattern
 | 
						|
 * @type {RegExp}
 | 
						|
 */
 | 
						|
const emailRegex = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/g;
 | 
						|
 | 
						|
/**
 | 
						|
 * Checks that a candidate string is an email
 | 
						|
 * @param candidateEmail {string}
 | 
						|
 * @return {boolean}
 | 
						|
 */
 | 
						|
export default (candidateEmail: string): boolean => emailRegex.test(String(candidateEmail));
 |