class Selector {
  inputs = [];

  constructor() {
    const selectAllInput = document.querySelector('#select-all');

    this.inputs = document.querySelectorAll(`[name=${selectAllInput.dataset.input}`);

    selectAllInput.onchange = this.onClick;
  }

  onClick = e => {
    const targetValue = e.target.checked;

    this.inputs.forEach(input => {
      input.checked = targetValue;
    });
  };
}

export default Selector;
