<commit_before>var _ = require('lodash');
var jstoxml = require('jstoxml');

var componentToJson = function (component) {
  var componentJson = {};
  var componentArray = [];
  var name;

  if (_.isArray(component)) {
    _.forEach(component, function (item) {
      componentArray.push(componentToJson(item));
    });

    return componentArray;
  }

  if (component.type && component.type.displayName) {
    name = component.type.displayName;
  } else if (component.type) {
    name = component.type;
  } else {
    return component;
  }

  var children;

  if (component.props && component.props.children) {
    children = component.props.children;
    children = _.isArray(children) ? children : [children];
    children = _.clone(children);
    children = _.map(children, componentToJson);
  }

  var matchingProps;

  if (component.type && component.type.defaultProps) {
    matchingProps = _.omit(component.props, function (val, key) {
      return component.type.defaultProps[key] === component.props[key];
    });
  } else {
    matchingProps = component.props;
  }

  var props = _.chain(matchingProps)<commit_msg>remove extraneous clone<commit_after>var _ = require('lodash');
var jstoxml = require('jstoxml');

var componentToJson = function (component) {
  var componentJson = {};
  var componentArray = [];
  var name;

  if (_.isArray(component)) {
    _.forEach(component, function (item) {
      componentArray.push(componentToJson(item));
    });

    return componentArray;
  }

  if (component.type && component.type.displayName) {
    name = component.type.displayName;
  } else if (component.type) {
    name = component.type;
  } else {
    return component;
  }

  var children;

  if (component.props && component.props.children) {
    children = component.props.children;
    children = _.isArray(children) ? children : [children];
    children = _.map(children, componentToJson);
  }

  var matchingProps;

  if (component.type && component.type.defaultProps) {
    matchingProps = _.omit(component.props, function (val, key) {
      return component.type.defaultProps[key] === component.props[key];
    });
  } else {
    matchingProps = component.props;
  }

  var props = _.chain(matchingProps)
{'fraction_non_alphanumeric': 0.1335431654676259, 'fraction_numerical': 0.0, 'mean_word_length': 3.5501022494887526, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1125738', 'n_tokens_mistral': 673, 'n_tokens_neox': 653, 'n_words': 141}