<commit_before>;(function(window) {

    var rgb2hex = function(color) {

        if(typeof color !== 'string') {
            // throw error of input isn't typeof string
            throw new Error('color has to be type of `string`');
        } else if (color.substr(0, 1) === '#') {
            // or return if already rgb color
            return {
                hex: color,
                alpha: 1
            };
        }

        // parse input
        var digits = /^rgba?\((\d+),(\d+),(\d+)(,[0-1]?\.?[0-9]+)?\)$/.exec(color.replace(/\s+/g,''));

        if(!digits) {
            // or throw error if input isn't a valid rgb(a) color
            throw new Error('given color (' + color + ') isn\'t a valid rgb or rgba color');
        }

        var red = parseInt(digits[1]);
        var green = parseInt(digits[2]);
        var blue = parseInt(digits[3]);
        var alpha = digits[4] ? /([0-9\.]+)/.exec(digits[4])[0] : '1';
        var rgb = ((blue | green << 8 | red << 16) | 1 << 24).toString(16).slice(1);

        // parse alpha value into float
        if(alpha.substr(0,1) === '.') {
            alpha = parseFloat('0' + alpha, 10);
        }

        // limit alpha value to 1
        if(alpha > 1) {
            alpha = 1;
        }

        // cut alpha value after 2 digits after comma
        alpha = parseFloat(Math.round(alpha * 100), 10) / 100;

        return {
            hex: '#' + rgb.toString(16),
            alpha: alpha
        };

    };

    if(typeof define === 'function' && define.amd) {
        define('rgb2hex', function () {
            return rgb2hex;
        });
    } else {
        window.rgb2hex = rgb2hex;
    }

}(window));<commit_msg>fixes use of parseInt/parseFloat<commit_after>;(function(window) {

    var rgb2hex = function(color) {

        if(typeof color !== 'string') {
            // throw error of input isn't typeof string
            throw new Error('color has to be type of `string`');
        } else if (color.substr(0, 1) === '#') {
            // or return if already rgb color
            return {
                hex: color,
                alpha: 1
            };
        }

        // parse input
        var digits = /^rgba?\((\d+),(\d+),(\d+)(,[0-1]?\.?[0-9]+)?\)$/.exec(color.replace(/\s+/g,''));

        if(!digits) {
            // or throw error if input isn't a valid rgb(a) color
            throw new Error('given color (' + color + ') isn\'t a valid rgb or rgba color');
        }

        var red = parseInt(digits[1], 10);
        var green = parseInt(digits[2], 10);
        var blue = parseInt(digits[3], 10);
        var alpha = digits[4] ? /([0-9\.]+)/.exec(digits[4])[0] : '1';
        var rgb = ((blue | green << 8 | red << 16) | 1 << 24).toString(16).slice(1);

        // parse alpha value into float
        if(alpha.substr(0,1) === '.') {
            alpha = parseFloat('0' + alpha);
        }

        // limit alpha value to 1
        if(alpha > 1) {
            alpha = 1;
        }

        // cut alpha value after 2 digits after comma
        alpha = parseFloat(Math.round(alpha * 100)) / 100;

        return {
            hex: '#' + rgb.toString(16),
            alpha: alpha
        };

    };

    if(typeof define === 'function' && define.amd) {
        define('rgb2hex', function () {
            return rgb2hex;
        });
    } else {
        window.rgb2hex = rgb2hex;
    }

}(window));
{'fraction_non_alphanumeric': 0.16995001470155838, 'fraction_numerical': 0.029403116730373418, 'mean_word_length': 1.5694864048338368, 'pattern_counts': {'":': 0, '<': 15, '<?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': '3126943', 'n_tokens_mistral': 1142, 'n_tokens_neox': 1032, 'n_words': 279}