title: Split a pipe delimited key-value pair separated by '=' symbol
body: <p>We are receiving an input parameter value as a pipe-delimited key-value pair, separated with <code>=</code> symbols. For example: </p>
  
  <pre><code>"|User=0101|Name=ImNewUser|IsAdmin=0|RefId=23ae2123cd223bf235|"
  </code></pre>
  
  <p>So the format is: <code>|KEY=VALUE|KEY_2=VALUE_2|....|KEY_n=VALUE_n|</code></p>
  
  <p>I need to split it into a JSON object. So, my object should be :</p>
  
  <pre><code>{
   'User':'0101',
   'Name':'ImNewUser',
   'IsAdmin':'0',
   'RefId'='23ae2123cd223bf235'
  }
  </code></pre>
  
  <p>What will be best way to go, since there are multiple options:</p>
  
  <ul>
  <li>I can use split with <code>|</code> and again on each element split with <code>=</code>.</li>
  <li>I can depend on regular expression and do string replace.</li>
  <li>Split it with <code>=</code> remove trailing <code>|</code> symbol and associate two
  different arrays with indexes.</li>
  </ul>
  
  <p>Can anyone tell me the best/most efficient way of doing this in JavaScript (programming in Node.js)?</p>