<commit_before>var sys = require('sys');
var http = require('http');
var qs = require('querystring');

exports.connection = function(apiKey) {

	return new Prowl(apiKey);
};

function Prowl(apiKey) {

	if (!apiKey || apiKey.length !== 40) {
		sys.puts('Must supply a valid Prowl API key');
		return false;
	}
	this.apiKey = apiKey || '';
	this.url = 'prowl.weks.net';
};

Prowl.prototype.send = function(args, callback) {

	var self = this;

	if (!self.apiKey || self.apiKey.length !== 40) {
		sys.puts('Tried to send notification without valid Prowl API key.');
		return false;
	}

	var options = {
		'application': ''
		,'event': ''
		,'description': ''
		,'priority': 0
	};
	
	for(key in args) {
		options[key] = args[key];
	}
	
	if (!options.application && !options.event && !options.description) {
		sys.puts('Tried to send notification without any information.');
		return false;
	}
	
	options.apikey = this.apiKey;

	options.application = options.application.substr(0,256);
	options.event = options.event.substr(0,1024);
	options.description = options.description.substr(0,10000);
	
	var client = http.createClient(443, self.url);

	try {
		client.setSecure('','X509_PEM');
	} catch (e) {

		sys.puts('SSL is not supported in your version of node JS. This is needed for this module to function.');
		return false;
	}

	var postData = qs.stringify(options);
	var headers = {
		'Accept': '*/*'
		,'Host': self.url
		,'User-Agent': 'node-prowl'
		,'Content-Type': 'application/x-www-form-urlencoded'
		,'Content-Length': postData.length
	};<commit_msg>Less code<commit_after>var sys = require('sys');
var http = require('http');
var qs = require('querystring');

exports.connection = function(apiKey) {

	return new Prowl(apiKey);
};

function Prowl(apiKey) {

	if (!apiKey || apiKey.length !== 40) {
		sys.puts('Must supply a valid Prowl API key');
		return false;
	}
	this.apiKey = apiKey || '';
	this.url = 'prowl.weks.net';
};

Prowl.prototype.send = function(args, callback) {

	var self = this;

	if (!self.apiKey || self.apiKey.length !== 40) {
		sys.puts('Tried to send notification without valid Prowl API key.');
		return false;
	}

	var options = {
		'application': ''
		,'event': ''
		,'description': ''
		,'priority': 0
	};
	
	for(key in args) {
		options[key] = args[key];
	}
	
	if (!options.application && !options.event && !options.description) {
		sys.puts('Tried to send notification without any information.');
		return false;
	}
	
	options.apikey = this.apiKey;

	options.application = options.application.substr(0,256);
	options.event = options.event.substr(0,1024);
	options.description = options.description.substr(0,10000);
	
	var client = http.createClient(443, self.url);

	try {
		client.setSecure();
	} catch (e) {

		sys.puts('SSL is not supported in your version of node JS. This is needed for this module to function.');
		return false;
	}

	var postData = qs.stringify(options);
	var headers = {
		'Accept': '*/*'
		,'Host': self.url
		,'User-Agent': 'node-prowl'
		,'Content-Type': 'application/x-www-form-urlencoded'
		,'Content-Length': postData.length
	};
{'fraction_non_alphanumeric': 0.16704361873990306, 'fraction_numerical': 0.015831987075928918, 'mean_word_length': 3.9935483870967743, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1488190', 'n_tokens_mistral': 1161, 'n_tokens_neox': 1056, 'n_words': 259}