<commit_before>'use strict'

// https://github.com/davideancona/JSONstringify
// License: Unknown

const default_depth = 2 // default truncation depth
const object_trunc = '[Object]' // string for truncated objects
const getter_trunc = '[Getter]' // string for getters
const cycle_trunc = '[Circular]' // string for truncated cycles

// handler for bookkeeping of visited indexes of arrays
let array_handler={
    not_in_visited:(k,next) => k>=next,  // all indexes >= next have not been visited yet
    add_visited:node => {node.visited++}, // assuming the standard visiting order for array elements, k===node.visited holds (hence the visited index k is useless as parameter here)
    init_visited:() => 0 // first index to visit is 0
}

// handler for bookkeeping of visited properties of non array objects
let object_handler={
    not_in_visited:(k,prop_set) => !prop_set.includes(k), // all properties not in prop_set have not been visited yet
    add_visited:(node,k) => {node.visited.push(k)}, // push property k on the array of visited properties of node.value
    init_visited:() => [] // visited properties are initially the empty array<commit_msg>docs: update license of jsonTrunc.js<commit_after>'use strict'

// https://github.com/davideancona/JSONstringify
// License: MIT

const default_depth = 2 // default truncation depth
const object_trunc = '[Object]' // string for truncated objects
const getter_trunc = '[Getter]' // string for getters
const cycle_trunc = '[Circular]' // string for truncated cycles

// handler for bookkeeping of visited indexes of arrays
let array_handler={
    not_in_visited:(k,next) => k>=next,  // all indexes >= next have not been visited yet
    add_visited:node => {node.visited++}, // assuming the standard visiting order for array elements, k===node.visited holds (hence the visited index k is useless as parameter here)
    init_visited:() => 0 // first index to visit is 0
}

// handler for bookkeeping of visited properties of non array objects
let object_handler={
    not_in_visited:(k,prop_set) => !prop_set.includes(k), // all properties not in prop_set have not been visited yet
    add_visited:(node,k) => {node.visited.push(k)}, // push property k on the array of visited properties of node.value
    init_visited:() => [] // visited properties are initially the empty array
{'fraction_non_alphanumeric': 0.10801543077582512, 'fraction_numerical': 0.002571795970852979, 'mean_word_length': 4.233183856502242, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 2, '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': '3049392', 'n_tokens_mistral': 673, 'n_tokens_neox': 635, 'n_words': 255}