<commit_before>var request = require('request'),
    url = require('url');

var majesticURL = {
  protocol: 'http',
  host: 'enterprise.majesticseo.com',
  pathname: '/api/json'
};

if (process.env.NODE_ENV === 'test') {
  majesticURL.host = 'developer.majesticseo.com';
}

module.exports = function(apiKey) {

  function doRequest(command, items, options, callback) {
    var query = {
        app_api_key: apiKey,
        cmd: command
    };

    if (options.backlinkSource) {
      query.datasource = options.backlinkSource;
    }

    if (command === 'GetBackLinkData') {
      query.item = items;
    } else if (items) {
      items.forEach(function(value, index) {
        query['item' + index] = (command === 'GetIndexItemInfo') ? encodeURI(value) : value;
      });
      if (command === 'GetIndexItemInfo') {
        query.items = items.length;
      }
      query.EnableResourceUnitFailover = 1;
    }

    request.post(url.format(majesticURL), {form: query}, makeResponseHandler(callback));
  }

  return {
    getSubscriptionInfo: doRequest.bind(null, 'GetSubscriptionInfo', null, {}),
    getIndexItemInfo: doRequest.bind(null, 'GetIndexItemInfo'),
    getKeywordInfo: doRequest.bind(null, 'GetKeywordInfo'),
    getBackLinkData: function(item, options, callback) {
      return doRequest('GetBackLinkData', item, options, callback);
    }
  };
};<commit_msg>Pass through backlinkCount parameter correctly.<commit_after>var request = require('request'),
    url = require('url');

var majesticURL = {
  protocol: 'http',
  host: 'enterprise.majesticseo.com',
  pathname: '/api/json'
};

if (process.env.NODE_ENV === 'test') {
  majesticURL.host = 'developer.majesticseo.com';
}

module.exports = function(apiKey) {

  function doRequest(command, items, options, callback) {
    var query = {
        app_api_key: apiKey,
        cmd: command
    };

    if (options.backlinkSource) {
      query.datasource = options.backlinkSource;
    }

    if (command === 'GetBackLinkData') {
      query.item = items;
      if (options.backlinkCount) query.Count = options.backlinkCount;
    } else if (items) {
      items.forEach(function(value, index) {
        query['item' + index] = (command === 'GetIndexItemInfo') ? encodeURI(value) : value;
      });
      if (command === 'GetIndexItemInfo') {
        query.items = items.length;
      }
      query.EnableResourceUnitFailover = 1;
    }

    request.post(url.format(majesticURL), {form: query}, makeResponseHandler(callback));
  }

  return {
    getSubscriptionInfo: doRequest.bind(null, 'GetSubscriptionInfo', null, {}),
    getIndexItemInfo: doRequest.bind(null, 'GetIndexItemInfo'),
    getKeywordInfo: doRequest.bind(null, 'GetKeywordInfo'),
    getBackLinkData: function(item, options, callback) {
      return doRequest('GetBackLinkData', item, options, callback);
    }
  };
};
{'fraction_non_alphanumeric': 0.14396067415730338, 'fraction_numerical': 0.0007022471910112359, 'mean_word_length': 3.493690851735016, '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': '6968899', 'n_tokens_mistral': 905, 'n_tokens_neox': 898, 'n_words': 172}