<commit_before>/** Created by ianarsenault on 11/9/16. */

/***+++++++++++++++  WIP ++++++++++++++++++++**/


/**
 * @param letter
 * @returns {*}
 */
function alphabetPosition(letter) {
    if (letter.charCodeAt(0) >= 97 && letter.charCodeAt(0) <= 122) {
        return letter.charCodeAt(0) - 97;
    }
    else if (letter.charCodeAt(0) >= 65 && letter.charCodeAt(0) <= 90) {
        return letter.charCodeAt(0) - 65;
    }
    else {
        return letter.charCodeAt(0);
    }
}

/**
 * @param char
 * @param rot
 * @returns {string}
 */
function rotateCharacter(char, rot) {
    var c = alphabetPosition(char);
    if (char == char.toUpperCase()) {
        return String.fromCharCode(((c + rot) % 26) + 65);
    }
    else if (char == char.toLowerCase()) {
        return String.fromCharCode(((c + rot) % 26) + 97);
    }
    else {
        return String.fromCharCode(c);
    }

}

function encrypt() {
    
}

/** end WIP **/


/**
 * @param str
 * @returns {string}
 */
function rot13(str) {

    // Create empty array
    var newArr = [];
    // Split the string up into an array
    var arr = str.split('');

    // Loop through the array length
    for (var i = 0; i < arr.length; i++) {
        // Assign each char code of i to x
        var x = arr[i].charCodeAt(0);

        // If x >= 78 and <=90 or  x >= 110 and x <= 122
        if (x >= 78 && x <= 90 || x >= 110 && x <= 122) {
            // We subtract 13 from its unicode number
            x = x - 13;
            // Return string character<commit_msg>Updated encrypt function for sub + caesar<commit_after>/** Created by ianarsenault on 11/9/16. */

/***+++++++++++++++  WIP ++++++++++++++++++++**/


/**
 * @param letter
 * @returns {*}
 */
function alphabetPosition(letter) {
    if (letter.charCodeAt(0) >= 97 && letter.charCodeAt(0) <= 122) {
        return letter.charCodeAt(0) - 97;
    }
    else if (letter.charCodeAt(0) >= 65 && letter.charCodeAt(0) <= 90) {
        return letter.charCodeAt(0) - 65;
    }
    else {
        return letter.charCodeAt(0);
    }
}

/**
 * @param char
 * @param rot
 * @returns {string}
 */
function rotateCharacter(char, rot) {
    var c = alphabetPosition(char);
    if (char == char.toUpperCase()) {
        return String.fromCharCode(((c + rot) % 26) + 65);
    }
    else if (char == char.toLowerCase()) {
        return String.fromCharCode(((c + rot) % 26) + 97);
    }
    else {
        return String.fromCharCode(c);
    }

}

/**
 * @param text
 * @param rot
 * @returns {string}
 */
function encryptCeasar(text, rot) {
    var encryptedMessage = [];
    for (var i = 0; i < text.length; i++) {
        encryptedMessage.push(rotateCharacter(i, rot));

    }
    return encryptedMessage.join('');
}

/** TODO : Add vigenere cipher function
 *  TODO: Update Homepage + About + Ciphers [Modals]
 */
/** end WIP **/


/**
 * @param str
 * @returns {string}
 */
function rot13(str) {

    // Create empty array
    var newArr = [];
    // Split the string up into an array
    var arr = str.split('');

    // Loop through the array length
    for (var i = 0; i < arr.length; i++) {
        // Assign each char code of i to x
        var x = arr[i].charCodeAt(0);

        // If x >= 78 and <=90 or  x >= 110 and x <= 122
        if (x >= 78 && x <= 90 || x >= 110 && x <= 122) {
            // We subtract 13 from its unicode number
            x = x - 13;
            // Return string character
{'fraction_non_alphanumeric': 0.17971269422456757, 'fraction_numerical': 0.03605980650835532, 'mean_word_length': 2.1680594243268336, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 15, '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': '5578341', 'n_tokens_mistral': 1251, 'n_tokens_neox': 1120, 'n_words': 325}