<commit_before>const regex = /(\d+),(\d+),(\d+)/

export default class Color {
  
  static parseString(str) {
    let res = regex.exec(str)
    this.value = res.shift().slice(0)
  }
  
  static isValid(str) {
    return regex.test(str)
  }
  
  toString() {
    return "Color"
  }
  
  toArray() {
    return this.value
  }
  
}<commit_msg>test if colour is valid before setting<commit_after>const regex = /(\d+),(\d+),(\d+)/

export default class Color {
  
  constructor(str = '') {
    this.value = Color.isValid(str) ? Color.parseString(str) : null
  }
  
  static parseString(str) {
    let res = regex.exec(str)
    this.value = res.shift().slice(0)
  }
  
  static isValid(str) {
    return regex.test(str)
  }
  
  toString() {
    return "Color"
  }
  
  toArray() {
    return this.value
  }
  
}
{'fraction_non_alphanumeric': 0.1600496277915633, 'fraction_numerical': 0.0024813895781637717, 'mean_word_length': 2.4935064935064934, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '482450', 'n_tokens_mistral': 302, 'n_tokens_neox': 301, 'n_words': 59}