<commit_before>/**
 * @param {string} type
 * @param {array|string} content
 * @param {number} line
 * @param {number} column
 * @constructor
 */
function Node(type, content, line, column) {
    this.type = type;
    this.content = content;
    this.start = {
        line: line,
        column: column
    };
}

Node.prototype = {
    type: null,

    content: null,

    start: null,

    /**
     * @param {Function} callback
     */
    map: function(callback) {
        callback(this);

        if (!Array.isArray(this.content)) return;

        this.content.forEach(function(node) {
            if (node instanceof Node)
                node.map(callback);
        });
    },

    /**
     * @param {String} type Node type
     * @param {Function} callback Function to call for every found node
     */
    forEach: function(type, callback) {
    },

    /**
     * @param {String} type Node type
     * @return {Node} First found child node of given type
     */
    find: function(type) {
        var i = 0;
        var l = this.content.length;

        for (; i < l; i++) {
            if (this.content[i].type === type) return this.content[i];
        }
    },

    /**
     * @param {String} type Node type
     * @return {Boolean} Whether there is a child node of given type
     */
    contains: function(type) {
        return this.content.some(function(node) {
            return node.type === type;
        });
    },

    toString: function() {<commit_msg>[api, node] Implement `forEach()` method<commit_after>/**
 * @param {string} type
 * @param {array|string} content
 * @param {number} line
 * @param {number} column
 * @constructor
 */
function Node(type, content, line, column) {
    this.type = type;
    this.content = content;
    this.start = {
        line: line,
        column: column
    };
}

Node.prototype = {
    type: null,

    content: null,

    start: null,

    /**
     * @param {Function} callback
     */
    map: function(callback) {
        callback(this);

        if (!Array.isArray(this.content)) return;

        this.content.forEach(function(node) {
            if (node instanceof Node)
                node.map(callback);
        });
    },

    /**
     * @param {String} type Node type
     * @param {Function} callback Function to call for every found node
     */
    forEach: function(type, callback) {
        var i = 0;
        var l = this.content.length;

        for (; i < l; i++) {
            if (this.content[i].type === type) callback(this.content[i]);
        }
    },

    /**
     * @param {String} type Node type
     * @return {Node} First found child node of given type
     */
    find: function(type) {
        var i = 0;
        var l = this.content.length;

        for (; i < l; i++) {
            if (this.content[i].type === type) return this.content[i];
        }
    },

    /**
     * @param {String} type Node type
     * @return {Boolean} Whether there is a child node of given type
     */
    contains: function(type) {
        return this.content.some(function(node) {
            return node.type === type;
        });
    },

    toString: function() {
{'fraction_non_alphanumeric': 0.1403118040089087, 'fraction_numerical': 0.0009545020680878142, 'mean_word_length': 1.9165120593692022, 'pattern_counts': {'":': 0, '<': 6, '<?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': '1715723', 'n_tokens_mistral': 952, 'n_tokens_neox': 921, 'n_words': 266}