chore(shared): Move org stuff to shared to be used by the lab
This commit is contained in:
parent
2dcf46befa
commit
a41b3f09a2
22 changed files with 33 additions and 15 deletions
|
@ -1,3 +1,4 @@
|
|||
import tlds from 'tlds/index.json' assert { type: 'json' }
|
||||
import get from 'lodash.get'
|
||||
import set from 'lodash.set'
|
||||
import orderBy from 'lodash.orderby'
|
||||
|
@ -222,3 +223,19 @@ export const objUpdate = (obj = {}, path, val = 'unset') => {
|
|||
|
||||
return obj
|
||||
}
|
||||
|
||||
/** Validates an email address for correct syntax */
|
||||
export const validateEmail = (email) => {
|
||||
/* eslint-disable */
|
||||
const re =
|
||||
/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
||||
/* eslint-enable */
|
||||
return re.test(email)
|
||||
}
|
||||
|
||||
/** Validates the top level domain (TLT) for an email address */
|
||||
export const validateTld = (email) => {
|
||||
const tld = email.split('@').pop().split('.').pop().toLowerCase()
|
||||
if (tlds.indexOf(tld) === -1) return tld
|
||||
else return true
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue