code: function styleLayer(layer) {
      var groups = _.map(layer, ruleGroup => {
          var groupedRules =  _.chain(ruleGroup.rules)
              .map(rule => {
                  // Add conditions to each rule, if any
                  var conditions = getConditions(rule);
                  if (conditions && conditions.length > 0) {
                      rule.conditions = conditions;
                  }
                  return rule;
              })
              .groupBy(subRule => {
                  // Group by conditions
                  return stringify(subRule.conditions);
              })
              .value();
          return _.values(groupedRules);
      });
  
      return groups.map(ruleGroup => {
          try {
              return ruleGroup.map(ruleSubgroup => {
                  return styleRuleGroup(ruleSubgroup);
              });
          }
          catch (e) {
              console.warn(e);
              return null;
          }
      });
  }
docs: Style a layer. The layer will have the following structure after being
  parsed:
  
  [
  [
  { ... }, // Rule groups...
  { ... },
  { ... }
  ]
  ]