analytics.js
function clean(obj) {
  var ret = {};

  // Remove traits/properties that are already represented
  // outside of the data container
  // TODO: Refactor into `omit` call
  var excludeKeys = ['id', 'name', 'firstName', 'lastName'];
  each(excludeKeys, function(omitKey) {
    clear(obj, omitKey);
  });

  // Flatten nested hierarchy, preserving arrays
  obj = flatten(obj);

  // Discard nulls, represent arrays as comma-separated strings
  // FIXME: This also discards `undefined`s. Is that OK?
  for (var key in obj) {
    if (has.call(obj, key)) {
      var val = obj[key];
      if (val == null) {
        continue;
      }

      if (is.array(val)) {
        ret[key] = val.toString();
        continue;
      }

      ret[key] = val;
    }
  }

  return ret;
}
function clean(obj) {
  var ret = {};

  // Remove traits/properties that are already represented
  // outside of the data container
  // TODO: Refactor into `omit` call
  var excludeKeys = ['id', 'name', 'firstName', 'lastName'];
  each(excludeKeys, function(omitKey) {
    clear(obj, omitKey);
  });

  // Flatten nested hierarchy, preserving arrays
  obj = flatten(obj);

  // Discard nulls, represent arrays as comma-separated strings
  // FIXME: This also discards `undefined`s. Is that OK?
  for (var key in obj) {
    if (has.call(obj, key)) {
      var val = obj[key];
      if (val == null) {
        continue;
      }

      if (is.array(val)) {
        ret[key] = val.toString();
        continue;
      }

      ret[key] = val;
    }
  }

  return ret;
}
function clean ( obj ) { var ret = { } ; // Remove traits/properties that are already represented // outside of the data container // TODO: Refactor into `omit` call var excludeKeys = [ 'id' , 'name' , 'firstName' , 'lastName' ] ; each ( excludeKeys , function ( omitKey ) { clear ( obj , omitKey ) ; } ) ; // Flatten nested hierarchy, preserving arrays obj = flatten ( obj ) ; // Discard nulls, represent arrays as comma-separated strings // FIXME: This also discards `undefined`s. Is that OK? for ( var key in obj ) { if ( has . call ( obj , key ) ) { var val = obj [ key ] ; if ( val == null ) { continue ; } if ( is . array ( val ) ) { ret [ key ] = val . toString ( ) ; continue ; } ret [ key ] = val ; } } return ret ; }
Clean all nested objects and arrays.

@api private
@param {Object} obj
@return {Object}
Clean all nested objects and arrays .