<commit_before>'use strict';
const {createChild, splitChild} = require('./child-operations');

function applyStyles(treeWithEntities, styleRanges) {
    return styleRanges.sort((style1, style2) => style1.offset >= style2.offset).reduce((children, styleRange) => {
        children.forEach((child) => {
            if (child.children) {
                child.children = getChildrenWithStyle(child, styleRange);
            }
        });

        return children;
    }, treeWithEntities);
}

function splitChildWithStyle(child, styleRange) {
    const nodeType = styleRange.style;

    return splitChild(child, styleRange, nodeType);
}

/* eslint-disable max-statements */
function getChildrenWithStyle(parent, styleRange) {
    let newChildren = [];
    let oldChildren = parent.children;<commit_msg>adding todos<commit_after>'use strict';
const {createChild, splitChild} = require('./child-operations');

function applyStyles(treeWithEntities, styleRanges) {
    //TODO: dcheck if dropping sorting possible
    return styleRanges.sort((style1, style2) => style1.offset >= style2.offset).reduce((children, styleRange) => {
        children.forEach((child) => {
            if (child.children) {
                child.children = getChildrenWithStyle(child, styleRange);
            }
        });
        //TODO: Check case where there is no entities ?
        return children;
    }, treeWithEntities);
}

function splitChildWithStyle(child, styleRange) {
    const nodeType = styleRange.style;

    return splitChild(child, styleRange, nodeType);
}

/* eslint-disable max-statements */
function getChildrenWithStyle(parent, styleRange) {
    let newChildren = [];
    let oldChildren = parent.children;
{'fraction_non_alphanumeric': 0.12044653349001175, 'fraction_numerical': 0.004700352526439483, 'mean_word_length': 3.4581151832460733, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '3894488', 'n_tokens_mistral': 464, 'n_tokens_neox': 460, 'n_words': 102}