<commit_before>const emailRegExp = /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i; // from angular
const urlRegExp = /^(http\:\/\/|https\:\/\/)(.{4,})$/;

export const validators = {
  email(value, attrValue, vnode) {
    return emailRegExp.test(value);
  },
  number(value) {
    return !isNaN(value);
  },
  url(value) {
    return urlRegExp.test(value);
  },
  required(value, attrValue, vnode) {
    if (attrValue === false) {
      return true;
    }

    if (value === 0) {
      return true;
    }

    if (Array.isArray(value)) {
      return !!value.length;
    }
    return !!value;
  },
  minlength(value, length) {
    return value.length >= length;
  },
  maxlength(value, length) {
    return length >= value.length;
  },
  pattern(value, pattern) {
    const patternRegExp = new RegExp('^' + pattern + '$');
    return patternRegExp.test(value);
  },
  min(value, min) {
    if (isNaN(min)) {
      return value >= min;
    }
    return value * 1 >= min * 1;
  },
  max(value, max, vnode) {
    if (isNaN(max)) {
      return max >= value;
    }
    return max * 1 >= value * 1;
  }
};
<commit_msg>Make vnode input type explicit<commit_after>const emailRegExp = /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i; // from angular
const urlRegExp = /^(http\:\/\/|https\:\/\/)(.{4,})$/;

export const validators = {
  email(value, attrValue, vnode) {
    return emailRegExp.test(value);
  },
  number(value) {
    return !isNaN(value);
  },
  url(value) {
    return urlRegExp.test(value);
  },
  required(value, attrValue, vnode) {
    if (attrValue === false) {
      return true;
    }

    if (value === 0) {
      return true;
    }

    if (Array.isArray(value)) {
      return !!value.length;
    }
    return !!value;
  },
  minlength(value, length) {
    return value.length >= length;
  },
  maxlength(value, length) {
    return length >= value.length;
  },
  pattern(value, pattern) {
    const patternRegExp = new RegExp('^' + pattern + '$');
    return patternRegExp.test(value);
  },
  min(value, min, vnode) {
    if (vnode.data.attrs.type.toLowerCase() == 'number') {
      return +value >= +min;
    }
    return value >= min;
  },
  max(value, max, vnode) {
    if (vnode.data.attrs.type.toLowerCase() == 'number') {
      return +max >= +value;
    }
    return max >= value;
  }
};

{'fraction_non_alphanumeric': 0.21794871794871795, 'fraction_numerical': 0.01488833746898263, 'mean_word_length': 2.6104477611940298, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '1410386', 'n_tokens_mistral': 959, 'n_tokens_neox': 946, 'n_words': 173}