<commit_before>var request = require('request');
var S = require('string');

var supportEmail = '<EMAIL>';

var captcha = 'captcha';

var Tuc = function() {}

Tuc.prototype.request = function( url, params, callback ){

    request.defaults({
        strictSSL: false, // allow us to use our self-signed cert for testing
        rejectUnauthorized: false
    });

    request.post(url, { form: params }, function (error, response, body) {
        if( error ){
            console.log( error, null );
        }
        else{
            callback( null, JSON.parse( body ) );
        }

    });

}

Tuc.prototype.getBalance = function( number, callback ){

    var url = 'https://mpeso.net/datos/consulta.php';

    var params = {
        "_funcion": "1",
        "_captcha": captcha,
        "_terminal": number,
        "_codigo": captcha
    }

    new Tuc().request( url, params, function(err, res){

        var balance = '';

        var regExp = /\s(\d{1,}.\d{2})/;

        if( res.Mensaje.match(regExp)[1] ){
            balance = 'C$ ' + res.Mensaje.match(regExp)[1];
        }
        else{
            balance = 'Error al obtener los datos';
        }

        callback( balance );
    });

}


Tuc.prototype.getType = function( number, callback ){

    var url = 'https://mpeso.net/datos/consulta.php';

    var params = {
        "_funcion": "2",
        "_captcha": captcha,
        "_ter": number,
        "_codigo": captcha
    }

    new Tuc().request( url, params, function(err, res){

        var type = S( S( S(res.Mensaje).stripTags().s.split(':')[1] ).trim().s ).capitalize().s;

        callback( type );
    });

}


module.exports = Tuc;<commit_msg>Refactoring<commit_after>var request = require('request');
var S = require('string');

var supportEmail = '<EMAIL>';

var captcha = 'captcha';

var Tuc = function() {}

Tuc.prototype.request = function( url, params, callback ){

    request.defaults({
        strictSSL: false, // allow us to use our self-signed cert for testing
        rejectUnauthorized: false
    });

    request.post(url, { form: params }, function (error, response, body) {
        if( error ){
            console.log( error, null );
        }
        else{
            callback( null, JSON.parse( body ) );
        }

    });

}

Tuc.prototype.getBalance = function( number, callback ){

    var url = 'https://mpeso.net/datos/consulta.php';

    var params = {
        "_funcion": "1",
        "_captcha": captcha,
        "_terminal": number,
        "_codigo": captcha
    }

    this.request( url, params, function(err, res){

        var balance = '';

        var regExp = /\s(\d{1,}.\d{2})/;
        var match = res.Mensaje.match(regExp)[1];

        if( match ){
            balance = 'C$ ' + match;
        }
        else{
            balance = 'Error al obtener los datos';
        }

        callback( balance );
    });

}


Tuc.prototype.getType = function( number, callback ){

    var url = 'https://mpeso.net/datos/consulta.php';

    var params = {
        "_funcion": "2",
        "_captcha": captcha,
        "_ter": number,
        "_codigo": captcha
    }

    this.request( url, params, function(err, res){

        var type = S( S( S(res.Mensaje).stripTags().s.split(':')[1] ).trim().s ).capitalize().s;

        callback( type );
    });

}


module.exports = Tuc;
{'fraction_non_alphanumeric': 0.16127098321342925, 'fraction_numerical': 0.0038968824940047962, 'mean_word_length': 2.0755760368663596, 'pattern_counts': {'":': 16, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 4, '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': '1713318', 'n_tokens_mistral': 1096, 'n_tokens_neox': 1048, 'n_words': 254}