<commit_before>// The global namespace for the library
var vinci = {}

// The primitive to process input-data in a certain way
// @TODO: Syntactic sugar to be added, using templates
vinci.draw = function (data, node, template) {

  // The temporary object to be packed in to data
  var payload = []

  // FUBAR the given data to comply with the template
  for (var i in data) {
    var tmp = {

      // @TODO: Needs recursion for n-th level objects
      name: i,
      children: (function () {
        var arr = []
        for (var j in data[i]) {
          arr.push({
            "name": (function () {
              var tmp = data[i][j].split("-")
              tmp.pop()
              return tmp.join("-")
            })()
          })
        }
        return arr
      })()
    }

    // Once dealt with a key-value, remove original
    delete data[i]

    // Constuct/populate the payload
    payload.push(tmp)
  }

  // Process the root-object for the Visualization
  data.name = "Viz"
  data.children = payload
<commit_msg>Undeniably awesome n-th level data travarsal is a GO! - Hierarchy agnostic (traces till any level of an Object) - Handles Numbers & Strings generously - Needs some bugfixing with Arrays<commit_after>// The global namespace for the library
var vinci = {}

// Needs to be generalized, supporting currying
vinci.trace = function (payload) {

  var warhead = []

  for (var i in payload) {
    if (typeof payload === "object") {
      warhead.push({
        name: i,
        children: (function () {
          if (typeof payload[i] !== "object")
            return [{ name: payload[i] }]
          return vinci.trace(payload[i])
        })()
      })
    } else {
      warhead.push({ name: payload[i] })
    }
  }
  return warhead
}

// The primitive to process input-data in a certain way
// @TODO: Syntactic sugar to be added, using templates
vinci.draw = function (payload, node, template) {

  // Construct the root-object for the Visualization
  var data = {
    name: "Viz",
    children: vinci.trace(payload)
  }

{'fraction_non_alphanumeric': 0.1151219512195122, 'fraction_numerical': 0.0, 'mean_word_length': 2.17984496124031, 'pattern_counts': {'":': 1, '<': 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': '3760332', 'n_tokens_mistral': 615, 'n_tokens_neox': 611, 'n_words': 219}