just-paja/improtresk-web

View on GitHub
src/forms/fields/emailField.js

Summary

Maintainability
A
0 mins
Test Coverage
import textField from './textField'

const emailField = ({
  messages,
  maxLength = 255,
  ...other
} = {}) => textField({
  allowEmpty: true,
  maxLength,
  messages: {
    pattern: 'forms.notAnEmail',
    ...messages
  },
  pattern: /^([a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)?$/,
  ...other
})

export default emailField