title: sort array by specific pattern
body: <p>I want to get the array from:</p>
  
  <pre><code>const foo = [
      FOO_BAR_A_READ_SELF,
      FOO_BAR_A_WRITE_SELF,
      FOO_BAR_A,
      FOO_BAR_A_READ_ALL,
      FOO_BAR_A_WRITE_ALL,
      FOO_BAR_B_READ_SELF,
      FOO_BAR_B_WRITE_SELF,
      FOO_BAR_B,
      FOO_BAR_B_READ_ALL,
      FOO_BAR_B_WRITE_ALL
  ]
  </code></pre>
  
  <p>to</p>
  
  <pre><code>const foo = [
      FOO_BAR_A,
      FOO_BAR_A_READ_SELF,
      FOO_BAR_A_WRITE_SELF,
      FOO_BAR_A_READ_ALL,
      FOO_BAR_A_WRITE_ALL,
      FOO_BAR_B,
      FOO_BAR_B_READ_SELF,
      FOO_BAR_B_WRITE_SELF,
      FOO_BAR_B_READ_ALL,
      FOO_BAR_B_WRITE_ALL
  ]
  </code></pre>
  
  <p>i tried to go with the length by splitting with the "_", but I never worked with the sort function that specific.</p>
  
  <p>I only used desc and asc ( return 1 > -1 ) || ( return -1 > 1 )</p>
  
  <p>Can someone can explain me how I can get the wanted result?</p>