title: Jquery parameterize string like parameterize method in rails
body: <p>Does jquery have parameterize method like in rails parameterize ?
  I want to parameterize string using jQuery, example :</p>
  
  <pre><code>"Jonh [ Doe ] " =&gt; "john-doe"
  
  " John ( Doe )" =&gt; "john-doe"
  
  "{ John } Doe / " =&gt; "john-doe"
  </code></pre>
  
  <p>I know that can use <code>toLowerCase()</code> and <code>.replace()</code>, but I want best practice to do it. Now I'm use this script</p>
  
  <pre><code>toLowerCase().replace(/\[|\]|\(|\)|\{|\}|\\|\//g, '').replace(/\s/g, '-')
  </code></pre>
  
  <p>or</p>
  
  <pre><code>toLowerCase().replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '-')
  </code></pre>
  
  <p>But the result look like this</p>
  
  <pre><code>"{ John } Doe / " =&gt; "-john--doe--"
  </code></pre>