<commit_before>// Response properties helper class
// Utilities to handle request properties easily
//////////////////////////////////////////////////

'use strict';

// NodeJS requires
var fs = require('fs');


//////////////////////////////////////////////////
// Initialization
//////////////////////////////////////////////////

// ResponseProperties constructor
function ResponsePropertiesHelper() {
}


//////////////////////////////////////////////////
// Helper functions
//////////////////////////////////////////////////

//Sorting function for categories
ResponsePropertiesHelper.getSortingResultForCategories = function(c1, c2) {
    var sortValues = [ c1, c2 ];
    for (var i = 0; i < 2; i++) {
        if (sortValues[i] == "Uncategorized") {
            sortValues[i] = "zz" + sortValues[i];
        } else if (sortValues[i].indexOf("(undocumented)") >= 0) {
            sortValues[i] = "zzz" + sortValues[i];
        } else if (sortValues[i] == "Undocumented") {
            sortValues[i] = "zzzz" + sortValues[i];<commit_msg>Protect against crash in category sorting<commit_after>// Response properties helper class
// Utilities to handle request properties easily
//////////////////////////////////////////////////

'use strict';

// NodeJS requires
var fs = require('fs');


//////////////////////////////////////////////////
// Initialization
//////////////////////////////////////////////////

// ResponseProperties constructor
function ResponsePropertiesHelper() {
}


//////////////////////////////////////////////////
// Helper functions
//////////////////////////////////////////////////

//Sorting function for categories
ResponsePropertiesHelper.getSortingResultForCategories = function(c1, c2) {
    var sortValues = [ c1, c2 ];
    for (var i = 0; i < 2; i++) {
        if (sortValues[i] == "Uncategorized") {
            sortValues[i] = "zz" + sortValues[i];
        } else if (sortValues[i] && sortValues[i].indexOf("(undocumented)") >= 0) {
            sortValues[i] = "zzz" + sortValues[i];
        } else if (sortValues[i] == "Undocumented") {
            sortValues[i] = "zzzz" + sortValues[i];
{'fraction_non_alphanumeric': 0.3410051667449507, 'fraction_numerical': 0.006575857209957727, 'mean_word_length': 1.4040632054176072, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '814512', 'n_tokens_mistral': 520, 'n_tokens_neox': 508, 'n_words': 131}