<commit_before>var request = require("request"),
    crypto = require("crypto"),
    querystring = require("querystring");

var BTCE = function(apiKey, secret, nonceGenerator) {
  var self = this;
  self.url = "https://btc-e.com/tapi";
  self.publicApiUrl = "https://btc-e.com/api/2/";
  self.apiKey = apiKey;
  self.secret = secret;
  self.nonce = nonceGenerator;

  self.makeRequest = function(method, params, callback) {
    var queryString,
        sign,
        headers;

    if(!self.apiKey || !self.secret) {
      callback(new Error("Must provide API key and secret to use the trade API."));
    }

    // If the user provided a function for generating the nonce, then use it.
    if(self.nonce) {
      params.nonce = self.nonce();
    } else {
      params.nonce = Math.round((new Date()).getTime() / 1000);
    }

    params.method = method;
    queryString = querystring.stringify(params);

    sign = crypto.createHmac("sha512", self.secret).update(new Buffer(queryString)).digest('hex').toString();
    headers = {
      'Sign': sign,
      'Key': self.apiKey
    };

    request({ url: self.url, method: "POST", form: params, headers: headers }, function(err, response, body) {
      if(err || response.statusCode !== 200) {
        callback(new Error(err ? err : response.statusCode));
        return;
      }<commit_msg>add a 'return' where I removed a throw in favor of a callback call<commit_after>var request = require("request"),
    crypto = require("crypto"),
    querystring = require("querystring");

var BTCE = function(apiKey, secret, nonceGenerator) {
  var self = this;
  self.url = "https://btc-e.com/tapi";
  self.publicApiUrl = "https://btc-e.com/api/2/";
  self.apiKey = apiKey;
  self.secret = secret;
  self.nonce = nonceGenerator;

  self.makeRequest = function(method, params, callback) {
    var queryString,
        sign,
        headers;

    if(!self.apiKey || !self.secret) {
      callback(new Error("Must provide API key and secret to use the trade API."));
      return;
    }

    // If the user provided a function for generating the nonce, then use it.
    if(self.nonce) {
      params.nonce = self.nonce();
    } else {
      params.nonce = Math.round((new Date()).getTime() / 1000);
    }

    params.method = method;
    queryString = querystring.stringify(params);

    sign = crypto.createHmac("sha512", self.secret).update(new Buffer(queryString)).digest('hex').toString();
    headers = {
      'Sign': sign,
      'Key': self.apiKey
    };

    request({ url: self.url, method: "POST", form: params, headers: headers }, function(err, response, body) {
      if(err || response.statusCode !== 200) {
        callback(new Error(err ? err : response.statusCode));
        return;
      }
{'fraction_non_alphanumeric': 0.14775629332360452, 'fraction_numerical': 0.008026267785479753, 'mean_word_length': 2.968162083936324, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '689057', 'n_tokens_mistral': 878, 'n_tokens_neox': 838, 'n_words': 216}