title: Python to JavaScript converter
body: <p>I want to convert some basic snippets to JavaScript, just pure Python I wrote myself to pure JavaScript. Is there any thing out there? Here the code.</p>
  
  <pre><code>items = init['items']
  
  itemsKeyedById = {i["id"]: i for i in items} # hard to convert.
  
  for item in items:
      if item["parents"][0]['isRoot'] == False:
          parent = itemsKeyedById[item["parents"][0]['id']]
  
          if "children" not in parent:
              parent["children"] = []
          parent["children"].append(item)
  
  topLevelItems = [item for item in items if item["parents"][0]['isRoot'] == True] # hard to convert.
  try:
      return json.dumps(topLevelItems[0]);  
  except:
      return '[]'
  </code></pre>
  
  <blockquote>
    <p>@Davide: Sadly this question has been closed, otherwise I'd write an answer instead of a comment. The best way to do have python as client side these days is with <a href="https://github.com/qquick/Transcrypt" rel="noreferrer">https://github.com/qquick/Transcrypt</a></p>
  </blockquote>