<commit_before>import isArray from 'lodash/isArray'

export default {
  'filled?': {
    check: (validatable) => !!validatable,
  },
  'int?': {
    check: (validatable) => /^\d+$/.test(validatable),
  },
  'date?': {
    check: (validatable) => /^\d{4}-\d{2}-\d{2}$/.test(validatable),
  },
  'max_size?': {
    check: (validatable, option) => validatable.length < option,
    translationOptions: option => ({ num: option }),
  },
  'gt?': {
    check: (validatable, option) => validatable > option,
    translationOptions: option => ({ num: option }),
  },
  'matches?': {
    check: (validatable, option) => validatable == option,
    translationOptions: option => ({ num: option }),
  },
  'format?': {
    check: (validatable, regex) => regex.test(validatable),
  },
  'size?': {
    check: (validatable, range) =>
      validatable.length > range[0] && validatable.length < range[1],
    argType: (arg) => isArray(arg) ? 'range' : 'default',
    translationOptions: (option) => ({
      size_left: option[0], size_right: option[1]
    }),
  },
}
<commit_msg>filled validation fails on empty array<commit_after>import isArray from 'lodash/isArray'

export default {
  'filled?': {
    check: (validatable) =>
      isArray(validatable) ? validatable.length : !!validatable,
  },
  'int?': {
    check: (validatable) => /^\d+$/.test(validatable),
  },
  'date?': {
    check: (validatable) => /^\d{4}-\d{2}-\d{2}$/.test(validatable),
  },
  'max_size?': {
    check: (validatable, option) => validatable.length < option,
    translationOptions: option => ({ num: option }),
  },
  'gt?': {
    check: (validatable, option) => validatable > option,
    translationOptions: option => ({ num: option }),
  },
  'matches?': {
    check: (validatable, option) => validatable == option,
    translationOptions: option => ({ num: option }),
  },
  'format?': {
    check: (validatable, regex) => regex.test(validatable),
  },
  'size?': {
    check: (validatable, range) =>
      validatable.length > range[0] && validatable.length < range[1],
    argType: (arg) => isArray(arg) ? 'range' : 'default',
    translationOptions: (option) => ({
      size_left: option[0], size_right: option[1]
    }),
  },
}

{'fraction_non_alphanumeric': 0.2038129822968679, 'fraction_numerical': 0.006354970494779845, 'mean_word_length': 3.488798370672098, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 33, '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': '2232805', 'n_tokens_mistral': 740, 'n_tokens_neox': 743, 'n_words': 151}