<commit_before>var qs = require('querystring');

var _ = require('lodash');
var string = require('string');

var DJ = require('dot-object');
// var str2json = require('string-to-json');

exports = module.exports = {};

var internals = {};

internals.isArray = function (obj) {
  for (var key in obj) {
    if (string(key).isNumeric()) {
      return true;
    }
  }

  return false;
};

internals.transform = function (kva) {
  var values = _.cloneDeep(kva);
  var nested;

  kva = [];

  for (var key in values) {
    nested = values[key];
    if (_.isObject(nested)) {
      kva.push(internals.parse(nested));
    } else {
      kva.push(nested);
    }
  }

  return kva;
};

internals.parse = function (obj) {
  var keyset = _.keys(obj);

  return (function _parse(index) {
    var key = keyset[index];

    if (_.isObject(obj[key])) {
      if (internals.isArray(obj[key])) {
        obj[key] = internals.transform(obj[key]);
      } else {
        obj[key] = internals.parse(obj[key]);
      }
    }

    if (index === keyset.length) {
      return obj;
    }

    return _parse(index + 1);
  }(0));
};

exports.parse = function (nvp, del) {
  del = del && !string(del).isAlphaNumeric() ? del : '.';

  var transformable = qs.parse(nvp);

  var parser = new DJ(del);
  parser.object(transformable);

  return internals.parse(transformable);
};<commit_msg>Remove artifacts and update parser name.<commit_after>var qs = require('querystring');

var _ = require('lodash');
var string = require('string');

var Parser = require('dot-object');

exports = module.exports = {};

var internals = {};

internals.isArray = function (obj) {
  for (var key in obj) {
    if (string(key).isNumeric()) {
      return true;
    }
  }

  return false;
};

internals.transform = function (kva) {
  var values = _.cloneDeep(kva);
  var nested;

  kva = [];

  for (var key in values) {
    nested = values[key];
    if (_.isObject(nested)) {
      kva.push(internals.parse(nested));
    } else {
      kva.push(nested);
    }
  }

  return kva;
};

internals.parse = function (obj) {
  var keyset = _.keys(obj);

  return (function _parse(index) {
    var key = keyset[index];

    if (_.isObject(obj[key])) {
      if (internals.isArray(obj[key])) {
        obj[key] = internals.transform(obj[key]);
      } else {
        obj[key] = internals.parse(obj[key]);
      }
    }

    if (index === keyset.length) {
      return obj;
    }

    return _parse(index + 1);
  }(0));
};

exports.parse = function (nvp, del) {
  del = del && !string(del).isAlphaNumeric() ? del : '.';

  var transformable = qs.parse(nvp);

  var parser = new Parser(del);
  parser.object(transformable);

  return internals.parse(transformable);
};
{'fraction_non_alphanumeric': 0.16789667896678967, 'fraction_numerical': 0.0018450184501845018, 'mean_word_length': 2.9063400576368874, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '3770560', 'n_tokens_mistral': 962, 'n_tokens_neox': 936, 'n_words': 208}