title: Refactor big switch statement
body: <p>I have the following switch statement:</p>
  
  <pre><code>switch (type) {
    case 1: // 1 BYTE 8-bit unsigned integer
      pointer = count &gt; 4 ? offset : pointer;
      for (let i = 0; i &lt; count; i++) {
        value += dataView.getUint8(pointer + i);
      }
      tag.value = parseInt(value, 10);
      return tag;
    case 3: // 3 SHORT 16-bit unsigned integer
      pointer = count &gt; 2 ? offset : pointer;
      for (let i = 0; i &lt; count; i++) {
        value += dataView.getUint16(pointer + 2 * i, littleEnd);
      }
      tag.value = parseInt(value, 10);
      return tag;
    case 4: // 4 LONG 32-bit unsigned integer
      pointer = count &gt; 1 ? offset : pointer;
      for (let i = 0; i &lt; count; i++) {
        value += dataView.getUint32(pointer + 4 * i, littleEnd);
      }
      tag.value = parseInt(value, 10);
      return tag;
    case 5:
    ...
  </code></pre>
  
  <p>and so on.</p>
  
  <p>The pattern is every time the same with some small variations. How can I refactor this? I want to refactor the pattern inside the case and I'm also trying to remove the whole switch block. Is that possible?</p>