<commit_before>$(document).ready(function() {
    'use strict';

  // define variables for code legibility
    var dropdownMenuToggle = $('.dropdown');
    var dropdownMenu = $('.dropdown-menu');
    var menuItems = dropdownMenu.find('a');

  // bind menu toggle click for later use
    dropdownMenuToggle.toggle(function() {
        dropdownMenu.addClass('expanded').find('a').first().focus();
        dropdownMenuToggle.addClass('active').attr('aria-expanded', 'true');
    }, function() {
        dropdownMenu.removeClass('expanded');
        dropdownMenuToggle.removeClass('active').attr('aria-expanded', 'false').focus();
    });

  // catch keypresses when focused on dropdownMenuToggle (we only care about spacebar keypresses here)
    dropdownMenuToggle.on('keydown', function(event) {
    // if space key pressed
        if (event.which == 32) {
            dropdownMenuToggle.click();
            event.preventDefault();
        }
    });

  // catch keypresses when inside dropdownMenu (we want to catch spacebar; escape; up arrow or shift+tab; and down arrow or tab)
    dropdownMenu.on('keydown', function(event) {
        catchKeyPress($(this), event);
    });

    function catchKeyPress(object, event) {
    // get currently focused item
        var focusedItem = jQuery(':focus');

    // get the number of focusable items
        var numberOfMenuItems = menuItems.length;

    // get the index of the currently focused item
        var focusedItemIndex = menuItems.index(focusedItem);

    // var to store next focused item index
        var itemToFocusIndex;

    // if space key pressed
        if (event.which == 32) {
            dropdownMenuToggle.click();
            event.preventDefault();
        }

    // if escape key pressed
        if (event.which == 27) {
            dropdownMenuToggle.click();
            event.preventDefault();
        }

        // if up arrow key pressed or shift+tab else down key or tab is pressed
        if (event.which == 38 || (event.which == 9 && event.shiftKey)) {
            // if first item go to last
            if (focusedItemIndex === 0) {
                menuItems.last().focus();
            } else {
                itemToFocusIndex = focusedItemIndex - 1;
                menuItems.get(itemToFocusIndex).focus();
            }
            event.preventDefault();
        } else if (event.which == 40 || event.which == 9) {
            // if last item go to first
            if (focusedItemIndex == numberOfMenuItems - 1) {
                menuItems.first().focus();
            } else {
                itemToFocusIndex = focusedItemIndex + 1;
                menuItems.get(itemToFocusIndex).focus();
            }
            event.preventDefault();<commit_msg>Quality fix, == to ===<commit_after>$(document).ready(function() {
    'use strict';

  // define variables for code legibility
    var dropdownMenuToggle = $('.dropdown');
    var dropdownMenu = $('.dropdown-menu');
    var menuItems = dropdownMenu.find('a');

  // bind menu toggle click for later use
    dropdownMenuToggle.toggle(function() {
        dropdownMenu.addClass('expanded').find('a').first().focus();
        dropdownMenuToggle.addClass('active').attr('aria-expanded', 'true');
    }, function() {
        dropdownMenu.removeClass('expanded');
        dropdownMenuToggle.removeClass('active').attr('aria-expanded', 'false').focus();
    });

  // catch keypresses when focused on dropdownMenuToggle (we only care about spacebar keypresses here)
    dropdownMenuToggle.on('keydown', function(event) {
    // if space key pressed
        if (event.which == 32) {
            dropdownMenuToggle.click();
            event.preventDefault();
        }
    });

  // catch keypresses when inside dropdownMenu (we want to catch spacebar; escape; up arrow or shift+tab; and down arrow or tab)
    dropdownMenu.on('keydown', function(event) {
        catchKeyPress($(this), event);
    });

    function catchKeyPress(object, event) {
    // get currently focused item
        var focusedItem = jQuery(':focus');

    // get the number of focusable items
        var numberOfMenuItems = menuItems.length;

    // get the index of the currently focused item
        var focusedItemIndex = menuItems.index(focusedItem);

    // var to store next focused item index
        var itemToFocusIndex;

    // if space key pressed
        if (event.which == 32) {
            dropdownMenuToggle.click();
            event.preventDefault();
        }

    // if escape key pressed
        if (event.which == 27) {
            dropdownMenuToggle.click();
            event.preventDefault();
        }

        // if up arrow key pressed or shift+tab else down key or tab is pressed
        if (event.which === 38 || (event.which === 9 && event.shiftKey)) {
            // if first item go to last
            if (focusedItemIndex === 0) {
                menuItems.last().focus();
            } else {
                itemToFocusIndex = focusedItemIndex - 1;
                menuItems.get(itemToFocusIndex).focus();
            }
            event.preventDefault();
        } else if (event.which === 40 || event.which === 9) {
            // if last item go to first
            if (focusedItemIndex === numberOfMenuItems - 1) {
                menuItems.first().focus();
            } else {
                itemToFocusIndex = focusedItemIndex + 1;
                menuItems.get(itemToFocusIndex).focus();
            }
            event.preventDefault();
{'fraction_non_alphanumeric': 0.12076502732240438, 'fraction_numerical': 0.0058287795992714025, 'mean_word_length': 2.1758241758241756, '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': '4921705', 'n_tokens_mistral': 1473, 'n_tokens_neox': 1379, 'n_words': 394}