<commit_before>require('jstree');

let template = ({
    "core": {
        'data': [],
        "themes": {
            "variant": "large"
        }
    },
    "checkbox": {
        "keep_selected_style": false
    },
    "plugins": ["wholerow", "checkbox"]
});

function treeStruct(tree, filePathObj, index, gitFolder) {
    if (filePathObj[index]) {
        let position = tree.findIndex(el => el.text == filePathObj[index]);
        if (position < 0 && index < filePathObj.length) {
            if (filePathObj[index] === "MakingCodeObjectOrientated" || filePathObj[index] === "electron-quick-start") {
                console.log(tree, filePathObj, index, gitFolder);
            }
            const newObj = {
                "text": filePathObj[index],
                "icon": "ti-folder",
                "children": []
            }
            var length = tree.push(newObj);
            position = length - 1;
        }
        if (index < filePathObj.length) {
            index++;
            treeStruct(tree[position].children, filePathObj, index, gitFolder);
        }
    } else if (index === filePathObj.length && gitFolder) {
        const url = gitFolder.config["remote \"origin\""] ? gitFolder.config["remote \"origin\""].url : "Repo is not store on remote"
        tree.push({
            "text": gitFolder.file.name,
            "icon": "icon-112",
            "children": [{
                "text": "URL: " + url,
                "icon": "ti-link"
            }, {
                "text": "Branch: " + gitFolder.repoInfo.branch,
                "icon": "icon-11"
            }]
        });
    }
};

exports.renderJsTree = (selector, gitFolder) => {
    let tree = [];
    for (let i = 0; i < gitFolder.length; i++) {
        let filePathObj = (gitFolder[i].repoInfo.root).split("\\");
        filePathObj.pop();
        treeStruct(tree, filePathObj, 0, gitFolder[i]);
    }
    template.core.data = tree;
    $(selector).jstree(template);
};<commit_msg>Neeattt<commit_after>require('jstree');

let template = ({
    "core": {
        'data': [],
        "themes": {
            "variant": "large"
        }
    },
    "checkbox": {
        "keep_selected_style": false
    },
    "plugins": ["wholerow", "checkbox"]
});

function treeStruct(tree, filePathObj, index, gitFolder) {
    if (filePathObj[index]) {
        let position = tree.findIndex(el => el.text == filePathObj[index]);
        if (position < 0 && index < filePathObj.length) {
            if (filePathObj[index] === "MakingCodeObjectOrientated" || filePathObj[index] === "electron-quick-start") {
                console.log(tree, filePathObj, index, gitFolder);
            }
            const newObj = {
                "text": filePathObj[index],
                "icon": "ti-folder",
                "children": []
            }
            var length = tree.push(newObj);
            position = length - 1;
        }
        if (index < filePathObj.length) {
            index++;
            treeStruct(tree[position].children, filePathObj, index, gitFolder);
        }
    } else if (index === filePathObj.length && gitFolder) {
        const url = gitFolder.config["remote \"origin\""] ? gitFolder.config["remote \"origin\""].url : "Repo is not store on remote"
        tree.push({
            "text": gitFolder.file.name,
            "icon": "icon-112",
            "children": [{
                "text": "URL: " + url,
                "icon": "ti-link",
                "state": {"disabled": true}
            }, {
                "text": "Branch: " + gitFolder.repoInfo.branch,
                "icon": "icon-11",
                "state": {"disabled": true}
            }]
        });
    }
};

exports.renderJsTree = (selector, gitFolder) => {
    let tree = [];
    for (let i = 0; i < gitFolder.length; i++) {
        let filePathObj = (gitFolder[i].repoInfo.root).split("\\");
        filePathObj.pop();
        treeStruct(tree, filePathObj, 0, gitFolder[i]);
    }
    template.core.data = tree;
    $(selector).jstree(template);
};
{'fraction_non_alphanumeric': 0.16410510659395142, 'fraction_numerical': 0.004462072384729797, 'mean_word_length': 1.8435517970401691, 'pattern_counts': {'":': 36, '<': 11, '<?xml version=': 0, '>': 7, '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': '873712', 'n_tokens_mistral': 1218, 'n_tokens_neox': 1183, 'n_words': 240}