<commit_before>//Node unique list
let NodeUniqueList = function () {
    Object.assign(this, {
        "_list": [],
        "_index": {}
    });
};

//Node unique list prototype
NodeUniqueList.prototype = {
    //Get a node by index
    "get": function (index) {
        return this._list[index];
    },
    //Check if a node is on this list
    "has": function (node) {
        if (typeof node !== "object" || node === null) {
            return false; //Terrible hack for preventing null nodes
        }
        return typeof this._index[node.id] !== "undefined";
    },
    //Execute a function for each node in the list
    "forEach": function (callback) {
        return this._list.forEach(callback);
    },
    //Add a new node to the list
    "add": function (node) {
        //Check if this node is not in the list
        if (typeof this._index[node.id] === "undefined") {
            this._list.push(node);
            this._index[node.id] = this._list.length - 1;
        }
    },
    //Remove a node item from the list
    "remove": function (node) {
        //TODO
    },
    //Get the number of items of the node list
    "length": function () {
        return this._list.length;
    }
};

//Create a new node list
export function createNodeList () {
    return new NodeUniqueList();
}
<commit_msg>Added method to empty the nodes list. Minor fixes<commit_after>//Node unique list
let NodeUniqueList = function () {
    this.list = []; //List of nodes
    this.index = {}; //Nodes indexes
};

//Node unique list prototype
NodeUniqueList.prototype = {
    //Get a node by index
    "get": function (index) {
        return this.list[index];
    },
    //Check if a node is on this list
    "has": function (node) {
        if (typeof node !== "object" || node === null) {
            return false; //Terrible hack for preventing null nodes
        }
        return typeof this.index[node.id] !== "undefined";
    },
    //Execute a function for each node in the list
    "forEach": function (callback) {
        return this.list.forEach(callback);
    },
    //Add a new node to the list
    "add": function (node) {
        //Check if this node is not in the list
        if (typeof this.index[node.id] === "undefined") {
            this.list.push(node);
            this.index[node.id] = this._list.length - 1;
        }
    },
    //Remove a node item from the list
    "remove": function (node) {
        //TODO
    },
    //Get the number of items of the node list
    "length": function () {
        return this.list.length;
    },
    //Remove all nodes from list
    "empty": function () {
        this.list = []; //Clean list of nodes
        this.index = {}; //Clean list of indexes
    }
};

//Create a new node list
export function createNodeList () {
    return new NodeUniqueList();
}

{'fraction_non_alphanumeric': 0.13122332859174965, 'fraction_numerical': 0.0007112375533428165, 'mean_word_length': 2.0676117775354417, 'pattern_counts': {'":': 15, '<': 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': '3334974', 'n_tokens_mistral': 805, 'n_tokens_neox': 797, 'n_words': 287}