<commit_before>// ------------------------------------------------------------------------------------------------------------- //
// no.http
// ------------------------------------------------------------------------------------------------------------- //

/**
    @param {string} url
    @param {Object} params
    @param {String} type
    @return {no.Promise}
*/
no.http = function(url, params, type) {
    var promise = new no.Promise();

    $.ajax({
        url: url,
        type: type || 'POST',
        data: params,
        dataType: 'json',
        success: function(data) {
            promise.resolve(data);
        },
        error: function(jqXHR, textStatus, errorThrown) {
            var error = errorThrown || textStatus || 'some error';
            promise.resolve({ error: error });
        }
    });

    return promise;
};

<commit_msg>Тип результата тоже можно задавать в no.http()<commit_after>// ------------------------------------------------------------------------------------------------------------- //
// no.http
// ------------------------------------------------------------------------------------------------------------- //

/**
    @param {string} url
    @param {object} params
    @param {string='POST'} type
    @param {string='json'} dataType
    @return {no.Promise}
*/
no.http = function(url, params, type, dataType) {
    var promise = new no.Promise();

    $.ajax({
        url: url,
        type: type || 'POST',
        data: params,
        dataType: dataType || 'json',
        success: function(data) {
            promise.resolve(data);
        },
        error: function(jqXHR, textStatus, errorThrown) {
            var error = errorThrown || textStatus || 'some error';
            promise.resolve({ error: error });
        }
    });

    return promise;
};


{'fraction_non_alphanumeric': 0.3580858085808581, 'fraction_numerical': 0.0, 'mean_word_length': 1.0077262693156732, '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': '6366840', 'n_tokens_mistral': 432, 'n_tokens_neox': 434, 'n_words': 109}