<commit_before>var columnDefs = [
    {field: 'athlete'},
    {field: 'age'},
    {field: 'country'},
    {field: 'sport'},
    {field: 'year'},
    {field: 'date'},
    {field: 'gold'},
    {field: 'silver'},
    {field: 'bronze'},
    {field: 'total'}
];

var gridOptions = {
    defaultColDef: {
        sortable: true,
        resizable: true,
        width: 150,
        enableRowGroup: true,
        enablePivot: true,
        enableValue: true
    },
    applyColumnDefOrder: true,
    rowGroupPanelShow: 'always',
    pivotPanelShow: 'always',
    columnDefs: columnDefs,
    rowData: null
};

function onBtSortAthleteAndMedalsFirst() {
    var currentColumnDefs = gridOptions.columnApi.getColumnDefs().reduce((acc, columnDef) => {
        acc[columnDef.field] = columnDef;
        return acc;
    }, {});

    var desiredColumnDefOrderAndState = [
        {field: 'gold'},
        {field: 'silver'},
        {field: 'bronze'},
        {field: 'total'},
        {field: 'athlete', sort: 'asc'},
        {field: 'age'},
        {field: 'country'},
        {field: 'sport'},
        {field: 'year'},
        {field: 'date'}
    ];

    var newColumnDefs = desiredColumnDefOrderAndState.map(columnDef => ({...currentColumnDefs[columnDef.field], ...columnDef}));

    gridOptions.api.setColumnDefs(newColumnDefs);
}

function onBtClearSortAthleteAndMedals() {
    var currentColumnDefs = gridOptions.columnApi.getColumnDefs().reduce((acc, columnDef) => {
        acc[columnDef.field] = columnDef;
        return acc;
    });

    var desiredColumnDefOrderAndState = [
        {field: 'athlete', sort: null},
        {field: 'age'},
        {field: 'country'},
        {field: 'sport'},
        {field: 'year'},
        {field: 'date'},
        {field: 'gold'},
        {field: 'silver'},
        {field: 'bronze'},
        {field: 'total'}
    ];

    var newColumnDefs = desiredColumnDefOrderAndState.map(columnDef => ({...currentColumnDefs[columnDef.field], ...columnDef}));

    gridOptions.api.setColumnDefs(newColumnDefs);
}<commit_msg>AG-4396 Create functional react example generator & runner<commit_after>var columnDefs = [
    {field: 'athlete'},
    {field: 'age'},
    {field: 'country'},
    {field: 'sport'},
    {field: 'year'},
    {field: 'date'},
    {field: 'gold'},
    {field: 'silver'},
    {field: 'bronze'},
    {field: 'total'}
];

var gridOptions = {
    defaultColDef: {
        sortable: true,
        resizable: true,
        width: 150,
        enableRowGroup: true,
        enablePivot: true,
        enableValue: true
    },
    applyColumnDefOrder: true,
    rowGroupPanelShow: 'always',
    pivotPanelShow: 'always',
    columnDefs: columnDefs,
    rowData: null
};

function onBtSortAthleteAndMedalsFirst() {
    var currentColumnDefs = gridOptions.columnApi.getColumnDefs().reduce((acc, columnDef) => {
        acc[columnDef.field] = columnDef;
        return acc;
    }, {});

    var desiredColumnDefOrderAndState = [
        {field: 'gold'},
        {field: 'silver'},
        {field: 'bronze'},
        {field: 'total'},
        {field: 'athlete', sort: 'asc'},
        {field: 'age'},
        {field: 'country'},
        {field: 'sport'},
        {field: 'year'},
        {field: 'date'}
    ];

    // var newColumnDefs = desiredColumnDefOrderAndState.map(columnDef => ({...currentColumnDefs[columnDef.field], ...columnDef}));

    gridOptions.api.setColumnDefs(newColumnDefs);
}

function onBtClearSortAthleteAndMedals() {
    var currentColumnDefs = gridOptions.columnApi.getColumnDefs().reduce((acc, columnDef) => {
        acc[columnDef.field] = columnDef;
        return acc;
    });

    var desiredColumnDefOrderAndState = [
        {field: 'athlete', sort: null},
        {field: 'age'},
        {field: 'country'},
        {field: 'sport'},
        {field: 'year'},
        {field: 'date'},
        {field: 'gold'},
        {field: 'silver'},
        {field: 'bronze'},
        {field: 'total'}
    ];

    // var newColumnDefs = desiredColumnDefOrderAndState.map(columnDef => ({...currentColumnDefs[columnDef.field], ...columnDef}));

    gridOptions.api.setColumnDefs(newColumnDefs);
}
{'fraction_non_alphanumeric': 0.16421154310553007, 'fraction_numerical': 0.002414875633904854, 'mean_word_length': 2.701519213583557, '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': '835902', 'n_tokens_mistral': 1349, 'n_tokens_neox': 1317, 'n_words': 260}