<commit_before>module.exports = {
    stack : function(error) {

        let stack = [];

        if('string' === typeof error.stack) {
            let lines = error.stack.split('at ');

            lines.shift();

            for(let line of lines) {

                let file = '';
                let column = 0;
                let row = 0;

                let path = line.match(/\(.+\)/g);

                if('object' === typeof path && null !== path) {
                    path = path[0].replace('(', '');
                    path = path.replace(')', '');

                    if(-1 !== path.indexOf(':')) path = path.split(':')[0];

                } else {
                    path = '';
                }

                let fileWithLineAndColumn = line.match(/\w+\.js:\d+:\d+|\w+\.\w+\.js:\d+:\d+/g);

                if('string' === typeof fileWithLineAndColumn[0]) {
                    let parts = fileWithLineAndColumn[0].split(':');

                    if('string' === typeof parts[0]) file = parts[0];
                    if('string' === typeof parts[1]) row = parts[1];
                    if('string' === typeof parts[2]) column = parts[2];

                }

                let method = line.split('(')[0].trim();
                method = (0 === method.indexOf('new')) ? method.replace('new ', '') + '.constructor' : method;

                if(path === '' && file !== '') {
                    path = file;
                }

                let entry = {
                    path : path,
                    file : file,
                    row : row,
                    column : column,
                    method : method
                };

                stack.push(entry);
            }
        }
<commit_msg>bugfix utils error stack<commit_after>module.exports = {
    stack : function(error) {

        let stack = [];

        if('string' === typeof error.stack) {
            let lines = error.stack.split('at ');

            lines.shift();

            for(let line of lines) {

                let file = '';
                let column = 0;
                let row = 0;

                let path = line.match(/\(.+\)/g);

                if('object' === typeof path && null !== path) {
                    path = path[0].replace('(', '');
                    path = path.replace(')', '');

                    if(-1 !== path.indexOf(':')) path = path.split(':')[0];

                } else {
                    path = '';
                }

                let fileWithLineAndColumn = line.match(/\w+\.js:\d+:\d+|\w+\.\w+\.js:\d+:\d+/g);

                if(
                    null !== typeof fileWithLineAndColumn &&
                    'object' === typeof fileWithLineAndColumn &&
                    'string' === typeof fileWithLineAndColumn[0]
                ) {
                    let parts = fileWithLineAndColumn[0].split(':');

                    if('string' === typeof parts[0]) file = parts[0];
                    if('string' === typeof parts[1]) row = parts[1];
                    if('string' === typeof parts[2]) column = parts[2];

                }

                let method = line.split('(')[0].trim();
                method = (0 === method.indexOf('new')) ? method.replace('new ', '') + '.constructor' : method;

                if(path === '' && file !== '') {
                    path = file;
                }

                let entry = {
                    path : path,
                    file : file,
                    row : row,
                    column : column,
                    method : method
                };

                stack.push(entry);
            }
        }

{'fraction_non_alphanumeric': 0.16334334881180004, 'fraction_numerical': 0.00819448238186288, 'mean_word_length': 1.057303370786517, 'pattern_counts': {'":': 0, '<': 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': '4246242', 'n_tokens_mistral': 1003, 'n_tokens_neox': 896, 'n_words': 194}