<commit_before>const GRADIENT = [
  [0.0, [255, 224, 102] ],
  [0.5, [192, 235, 117] ],
  [1.0, [102, 217, 232] ],
];

export default (percent) => {
  const upperIndex = GRADIENT.findIndex(([p]) => p >= percent);
  const [lp, [lr, lg, lb]] = GRADIENT[upperIndex - 1];
  const [up, [ur, ug, ub]] = GRADIENT[upperIndex];
  const upperPercentage = (percent - lp) / (up - lp);
  const lowerPercentage = 1 - upperPercentage;

  return `rgb(<commit_msg>guard against attempting to access index -1<commit_after>const GRADIENT = [
  [0.0, [255, 224, 102] ],
  [0.5, [192, 235, 117] ],
  [1.0, [102, 217, 232] ],
];

export default (percent) => {
  const upperIndex = GRADIENT.findIndex(([p]) => p >= percent);
  const [lp, [lr, lg, lb]] = GRADIENT[upperIndex ? upperIndex - 1 : 0];
  const [up, [ur, ug, ub]] = GRADIENT[upperIndex];
  const upperPercentage = (percent - lp) / (up - lp);
  const lowerPercentage = 1 - upperPercentage;

  return `rgb(
{'fraction_non_alphanumeric': 0.19234856535600425, 'fraction_numerical': 0.0765143464399575, 'mean_word_length': 3.6633663366336635, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '218571', 'n_tokens_mistral': 416, 'n_tokens_neox': 357, 'n_words': 101}