title: How to remove empty values from object using lodash
body: <p>I have an object with several properties and I would like to remove objects/nested objects that are empty, using lodash. What is the best way to do this?</p>
  
  <pre><code>Let template = {
        node: "test",
        representation: {
          range: { }
        },
        transmit: {
          timeMs: 0
        }
      };
  </code></pre>
  
  <p>to </p>
  
  <pre><code>template = {
        node: "test",
        transmit: {
          timeMs: 0
        }
      };
  </code></pre>
  
  <p>I tried something like this, but I am lost. </p>
  
  <pre><code>Utils.removeEmptyObjects = function(obj) {
    return _.transform(obj, function(o, v, k) {
      if (typeof v === 'object') {
        o[k] = _.removeEmptyObjects(v);
      } else if (!_.isEmpty(v)) {
        o[k] = v;
      }
    });
  };
  _.mixin({
    'removeEmptyObjects': Utils.removeEmptyObjects
  });
  </code></pre>