Skip to content

Instantly share code, notes, and snippets.

View harpalsinh-jadeja's full-sized avatar
🎯
Focusing

Harpal Singh Jadeja harpalsinh-jadeja

🎯
Focusing
  • Ahmedabad
View GitHub Profile
@harpalsinh-jadeja
harpalsinh-jadeja / Validate.js
Created August 14, 2017 13:35
React-native Validation using validate.js
import validation from 'validate.js'
export default function validate(fieldName, value) {
var constraints = {
email: {
presence: true,
format: {
pattern: /^(([^<>()\[\]\\.,;:\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,}))$/,
message: 'Invalid email id',
}