title: How to check for an empty Map in a Soy template?
body: <p>I've read the <a href="https://developers.google.com/closure/templates/docs/overview" rel="nofollow">docs</a> for Google Soy/Closure templates, but can't find any way to check whether a Map is empty; I can only look up the map's value for a given key. Is there a way to find out the size of a Map?</p>
  
  <p>My current workaround is to replace any empty maps with <code>null</code> and then check for <code>null</code> in the template, e.g.:</p>
  
  <pre><code>{if $myMap}
      &lt;!-- Do something that requires a non-empty map --&gt;
  {/if}
  </code></pre>