<commit_before>/* eslint-disable no-underscore-dangle */
/* @link http://stackoverflow.com/questions/46155/validate-email-address-in-javascript */
const EMAIL_REGEX = /^(([^<>()\[\]\\.,;:\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-disable-line no-useless-escape

const isEmpty = value =>
    typeof value === 'undefined' || value === null || value === '';

export const required = (value, _, props) =>
    isEmpty(value) ? props.translate('aor.validation.required') : undefined;

export const minLength = (min, message) => (value, _, props) =>
    !isEmpty(value) && value.length < min
        ? props.translate(message || 'aor.validation.minLength', { min })
        : undefined;

export const maxLength = (max, message) => (value, _, props) =>
    !isEmpty(value) && value.length > max
        ? props.translate(message || 'aor.validation.maxLength', { max })
        : undefined;

export const minValue = (min, message) => (value, _, props) =>
    !isEmpty(value) && value < min
        ? props.translate(message || 'aor.validation.minValue', { min })
        : undefined;

export const maxValue = (max, message) => (value, _, props) =>
    !isEmpty(value) && value > max
        ? props.translate(message || 'aor.validation.maxValue', { max })
        : undefined;

export const number = (value, _, props) =>
    !isEmpty(value) && isNaN(Number(value))
        ? props.translate('aor.validation.number')
        : undefined;

export const regex = (pattern, message) => (value, _, props) =>
    !isEmpty(value) && typeof value === 'string' && !pattern.test(value)
        ? props.translate(message)
        : undefined;

export const email = regex(EMAIL_REGEX, 'aor.validation.email');

export const choices = (list, message) => (value, _, props) =>
    !isEmpty(value) && list.indexOf(value) === -1
        ? props.translate(message)
        : undefined;<commit_msg>[RFR] Ensure validation custom messages without translation don't add warnings<commit_after>/* eslint-disable no-underscore-dangle */
/* @link http://stackoverflow.com/questions/46155/validate-email-address-in-javascript */
const EMAIL_REGEX = /^(([^<>()\[\]\\.,;:\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-disable-line no-useless-escape

const isEmpty = value =>
    typeof value === 'undefined' || value === null || value === '';

export const required = (value, _, props) =>
    isEmpty(value) ? props.translate('aor.validation.required') : undefined;

export const minLength = (min, message) => (value, _, props) =>
    !isEmpty(value) && value.length < min
        ? props.translate(message || 'aor.validation.minLength', {
              min,
              _: message,
          })
        : undefined;

export const maxLength = (max, message) => (value, _, props) =>
    !isEmpty(value) && value.length > max
        ? props.translate(message || 'aor.validation.maxLength', {
              max,
              _: message,
          })
        : undefined;

export const minValue = (min, message) => (value, _, props) =>
    !isEmpty(value) && value < min
        ? props.translate(message || 'aor.validation.minValue', {
              min,
              _: message,
          })
        : undefined;

export const maxValue = (max, message) => (value, _, props) =>
    !isEmpty(value) && value > max
        ? props.translate(message || 'aor.validation.maxValue', {
              max,
              _: message,
          })
        : undefined;

export const number = (value, _, props) =>
    !isEmpty(value) && isNaN(Number(value))
        ? props.translate('aor.validation.number')
        : undefined;

export const regex = (pattern, message) => (value, _, props) =>
    !isEmpty(value) && typeof value === 'string' && !pattern.test(value)
        ? props.translate(message, { _: message })
        : undefined;

export const email = regex(EMAIL_REGEX, 'aor.validation.email');

export const choices = (list, message) => (value, _, props) =>
    !isEmpty(value) && list.indexOf(value) === -1
        ? props.translate(message, { _: message })
        : undefined;
{'fraction_non_alphanumeric': 0.20820561188398962, 'fraction_numerical': 0.01178967224711153, 'mean_word_length': 2.9132841328413286, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1845333', 'n_tokens_mistral': 1367, 'n_tokens_neox': 1336, 'n_words': 260}