<commit_before>var SteamUser = require('../index.js');
var SteamID = require('steamid');

SteamUser.prototype.serverQuery = function(conditions, callback) {
	if (typeof conditions === 'string') {
		conditions = {"filter_text": conditions};
	}

	if (conditions.geo_location_ip) {
		var parts = conditions.geo_location_ip.split('.');
		var buf = new Buffer(4);

		parts.forEach(function(octet, index) {
			buf.writeUInt8(octet, index);
		});

		conditions.geo_location_ip = buf.readUInt32(0);
	}

	this._send(SteamUser.EMsg.ClientGMSServerQuery, conditions, function(body) {
		if (body.error) {
			callback(new Error(body.error));
			return;
		}

		callback(null, (body.servers || []).map(function(server) {
			var buf = new Buffer(4);<commit_msg>Fixed serverQuery crashing when passing geo_location_ip (fixes #113)<commit_after>var SteamUser = require('../index.js');
var Helpers = require('./helpers.js');
var SteamID = require('steamid');

SteamUser.prototype.serverQuery = function(conditions, callback) {
	if (typeof conditions === 'string') {
		conditions = {"filter_text": conditions};
	}

	if (conditions.geo_location_ip) {
		conditions.geo_location_ip = Helpers.ipStringToInt(conditions.geo_location_ip);
	}

	this._send(SteamUser.EMsg.ClientGMSServerQuery, conditions, function(body) {
		if (body.error) {
			callback(new Error(body.error));
			return;
		}

		callback(null, (body.servers || []).map(function(server) {
			var buf = new Buffer(4);
{'fraction_non_alphanumeric': 0.15405777166437415, 'fraction_numerical': 0.0068775790921595595, 'mean_word_length': 5.087866108786611, 'pattern_counts': {'":': 2, '<': 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': '4088349', 'n_tokens_mistral': 515, 'n_tokens_neox': 472, 'n_words': 90}