title: Javascript, Transforming object with underscore (or not)
body: <p>I am looking to prepare an object for send. It initially looks like so :</p>
  
  <pre><code>var myObj = {"state":{"Saved":true,"Committed":false,"Published":false},"discipline":{"Marketing":true}};
  </code></pre>
  
  <p>And needs to be change via looking at the inner objects and turning it into an array of keys of the objects who's values are true. So in this example it would change into this :</p>
  
  <pre><code> {"state":["Saved"],"discipline":["Marketing"]};
  </code></pre>
  
  <p>(committed and published were removed because they were set to false. )</p>
  
  <p>Here is what I've tried so far: </p>
  
  <pre><code>                function mutate() {
                     //map obj
                      return _.map(myObj, function(object){ 
                       //pluck keys that have = true
                          return _.keys(_.pick(object[0], Boolean));
                       });
                  }
  </code></pre>
  
  <p>Struggling with this a bit, and how to traverse and build this correctly. I am using underscore - but plain javascript is fine if it makes more sense. Thanks!</p>