check-email-address
v1.0.6
Published
Tiny library for checking email address whether it's valid or not. Support TypeScript
Downloads
6
Readme
check-email-address
Tiny library for checking email address whether it's valid or not with support of TypeScript Support in CJS, ESM and React App
Use Case
Installation
npm install check-email-address
or
yarn add check-email-address
Usage
Common JS
// CJS (Common JS)
const checkEmailAddress = require('check-email-address')
const emailAddr = '[email protected]'
const { isValid } = checkEmailAddress(emailAddr)
if(isValid){
console.log("Email valid")
} else {
console.log("Email is not valid")
}
ES Modules
// ESM (ES Modules)
import checkEmailAddress from 'check-email-address'
const emailAddr = '[email protected]'
const { isValid } = checkEmailAddress(emailAddr)
if(isValid){
console.log("Email valid")
} else {
console.log("Email is not valid")
}
React App
// React App (TSX)
import checkEmailAddress from 'check-email-address'
export default function Component(props: any){
...
const { isValid }: { isValid: boolean } = checkEmailAddress(email)
...
}