Last active
August 15, 2018 11:01
-
-
Save MicroBenz/0ec109f0abeab88a53d6fb94f86adf9e to your computer and use it in GitHub Desktop.
v8n
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function isEmpty(test) { | |
return test === null || test === undefined || test === ''; | |
} | |
export function isNumber(test) { | |
return test !== null && test !== undefined && typeof test === 'number'; | |
} | |
export function isGreaterThanZero(test) { | |
return !isEmpty(test) && isNumber(test) && test > 0; | |
} | |
export function isEmail(test) { | |
const emailRegex = /^(([^<>()\[\]\\.,;:\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,}))$/; | |
return emailRegex.test(test); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment