<commit_before>'use strict';

module.exports = (columns, column, done) => {
    // reset old classes
    columns.forEach(function (col) {
        col.headerClass = col.headerClass.replace('sort-asc', '');
        col.headerClass = col.headerClass.replace('sort-desc', '');
    });

    column.sort = column.sort === 'asc' ? 'desc' : 'asc';

    // push sorting hint
    column.headerClass += ' sort-' + column.sort;

    done({
        sortingColumn: column,
        columns: columns
    });
};

// sorter === lodash sortByOrder
// https://lodash.com/docs#sortByOrder
module.exports.sort = (data, column, sorter) => {
    if (!column) {
        return data;
    }

    return sorter(data, [column.property], [column.sort]);
};<commit_msg>case-insensitive sort<commit_after>'use strict';

import {isString} from 'lodash';

module.exports = (columns, column, done) => {
    // reset old classes
    columns.forEach(function (col) {
        col.headerClass = col.headerClass.replace('sort-asc', '');
        col.headerClass = col.headerClass.replace('sort-desc', '');
    });

    column.sort = column.sort === 'asc' ? 'desc' : 'asc';

    // push sorting hint
    column.headerClass += ' sort-' + column.sort;

    done({
        sortingColumn: column,
        columns: columns
    });
};

// sorter === lodash sortByOrder
// https://lodash.com/docs#sortByOrder
module.exports.sort = (data, column, sorter) => {
    if (!column) {
        return data;
    }

    let sortFn = function (row) {
        let value = row[column.property];
        return isString(value) ? value.toLowerCase() : value;
    };

    return sorter(data, [sortFn], [column.sort]);
};
{'fraction_non_alphanumeric': 0.17039274924471298, 'fraction_numerical': 0.0, 'mean_word_length': 2.7381489841986455, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '6230165', 'n_tokens_mistral': 527, 'n_tokens_neox': 512, 'n_words': 110}