code: function cleanUndefinedProperties(obj) {
    var newObj;
    var isArray = false;
    if (typeof obj === 'object' && obj !== null) {
      if (Array.isArray(obj)) {
        newObj = [];
        isArray = true;
      } else {
        newObj = {};
      }
    } else {
      return obj;
    }
    var keys = Object.keys(obj);
    keys.forEach(function (key, i) {
      if (isArray || typeof obj[key] !== 'undefined') {
        newObj[key] = cleanUndefinedProperties(obj[key]);
      }
    });
    return newObj;
  }
docs: /*
  Create a copy of the object without the undefined properties.
  @param obj Object to copy.