<commit_before>import Color from './color';
import Rgb   from './rgb';

const NAME = Symbol.for('HSL');
const KEYS = Object.freeze({
  H: Symbol.for('h'), 
  S: Symbol.for('s'), 
  L: Symbol.for('l')
});

export default class Hsl extends Color {
  constructor(h, s, l) {
    super(NAME, [[KEYS.H, h], [KEYS.S, s], [KEYS.L, l]]);
  }

  clone() {
    return new Hsl(...this.values());
  }

  isValid() {
    return this.entries().every(entry => {
      let key   = entry[0];
      let value = entry[1];
      if (key !== KEYS.H) {
        return Number.isFinite(value) && 0 <= value && value <= 1;
      }
      return Number.isInteger(value) && 0 <= value && value <= 360;
    });
  }

  cmy() {
    return this.rgb().cmy();
  }

  cmyk() {
    return this.rgb().cmyk();
  }

  hsl() {
    return this;
  }

  hsv() {
    return this.rgb().hsv();
  }

  rgb() {
    let [h, s, l] = this.values();
    if (s === 0) {
      let value = Math.floor(0xFF * l);
      return [value, value, value];
    }

    let m2 = 0;
    if (l < 0.5) {
      m2 = l * (s + 1);
    } else {
      m2 = l + s - l * s;
    }

    let m1 = 2 * l - m2;
    return new Rgb(
        Math.floor(0xFF * Hsl.hueToRgb(m1, m2, h / 360 + 1 / 3)),
        Math.floor(0xFF * Hsl.hueToRgb(m1, m2, h / 360)),
        Math.floor(0xFF * Hsl.hueToRgb(m1, m2, h / 360 - 1 / 3))
    );
  }

  xyz() {<commit_msg>Modified return value to fit interface definition<commit_after>import Color from './color';
import Rgb   from './rgb';

const NAME = Symbol.for('HSL');
const KEYS = Object.freeze({
  H: Symbol.for('h'), 
  S: Symbol.for('s'), 
  L: Symbol.for('l')
});

export default class Hsl extends Color {
  constructor(h, s, l) {
    super(NAME, [[KEYS.H, h], [KEYS.S, s], [KEYS.L, l]]);
  }

  clone() {
    return new Hsl(...this.values());
  }

  isValid() {
    return this.entries().every(entry => {
      let key   = entry[0];
      let value = entry[1];
      if (key !== KEYS.H) {
        return Number.isFinite(value) && 0 <= value && value <= 1;
      }
      return Number.isInteger(value) && 0 <= value && value <= 360;
    });
  }

  cmy() {
    return this.rgb().cmy();
  }

  cmyk() {
    return this.rgb().cmyk();
  }

  hsl() {
    return this;
  }

  hsv() {
    return this.rgb().hsv();
  }

  rgb() {
    let [h, s, l] = this.values();
    if (s === 0) {
      let value = Math.floor(0xFF * l);
      return new Rgb(value, value, value);
    }

    let m2 = 0;
    if (l < 0.5) {
      m2 = l * (s + 1);
    } else {
      m2 = l + s - l * s;
    }

    let m1 = 2 * l - m2;
    return new Rgb(
        Math.floor(0xFF * Hsl.hueToRgb(m1, m2, h / 360 + 1 / 3)),
        Math.floor(0xFF * Hsl.hueToRgb(m1, m2, h / 360)),
        Math.floor(0xFF * Hsl.hueToRgb(m1, m2, h / 360 - 1 / 3))
    );
  }

  xyz() {
{'fraction_non_alphanumeric': 0.19964093357271095, 'fraction_numerical': 0.03016157989228007, 'mean_word_length': 1.9638297872340424, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 5, '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': '3245250', 'n_tokens_mistral': 1196, 'n_tokens_neox': 1115, 'n_words': 281}