<commit_before>var validator = module.exports = require('validator');
validator.Validator.prototype.init = function(obj) {
	this.obj = obj;
	this.err = {};
	return this;
}
validator.Validator.prototype.chk = function(key, fail_msg, compulsory) {
	this.error = function(msg) {
		if ((this.obj.hasOwnProperty(key) || compulsory) && (!this.err.hasOwnProperty(key))) {
			this.err[key] = msg;
		}
		return this;
	}
	return this.check(this.obj[key], fail_msg);
}
validator.Validator.prototype.failed = function() {
	return Object.keys(this.err).length;
}
validator.Validator.prototype.rng = function(lb, ub) {
	if (!(this.obj[lb] <= this.obj[ub])) {
		this.err[lb] = lb + ' must be less than or equal to ' + ub;
	}
	return this;
}
validator.Filter.prototype.init = function(obj) {
	this.obj = obj;
	this.res = {};
	return this;
}
validator.Filter.prototype.snt = function(key, def) {
	this.modify = function(value) {
		this.res[key] = value;
	}
	return this.sanitize(this.obj.hasOwnProperty(key) ? this.obj[key] : def);
}
validator.Filter.prototype.wrap = function(value) {
	return this;
}
validator.Filter.prototype.copy = function() {
	this.modify(this.str);
	return this.wrap(this.str);
}
validator.Filter.prototype.toLowerCase = function() {
	this.modify(this.str.toLowerCase());
	return this.wrap(this.str);
}
<commit_msg>Added xss() to validator.js because node-validator 2.0.0 had removed the xss() method<commit_after>var validator = module.exports = require('validator');
validator.Validator.prototype.init = function(obj) {
	this.obj = obj;
	this.err = {};
	return this;
}
validator.Validator.prototype.chk = function(key, fail_msg, compulsory) {
	this.error = function(msg) {
		if ((this.obj.hasOwnProperty(key) || compulsory) && (!this.err.hasOwnProperty(key))) {
			this.err[key] = msg;
		}
		return this;
	}
	return this.check(this.obj[key], fail_msg);
}
validator.Validator.prototype.failed = function() {
	return Object.keys(this.err).length;
}
validator.Validator.prototype.rng = function(lb, ub) {
	if (!(this.obj[lb] <= this.obj[ub])) {
		this.err[lb] = lb + ' must be less than or equal to ' + ub;
	}
	return this;
}
validator.Filter.prototype.init = function(obj) {
	this.obj = obj;
	this.res = {};
	return this;
}
validator.Filter.prototype.snt = function(key, def) {
	this.modify = function(value) {
		this.res[key] = value;
	}
	return this.sanitize(this.obj.hasOwnProperty(key) ? this.obj[key] : def);
}
validator.Filter.prototype.wrap = function(value) {
	return this;
}
validator.Filter.prototype.copy = function() {
	this.modify(this.str);
	return this.wrap(this.str);
}
validator.Filter.prototype.toLowerCase = function() {
	this.modify(this.str.toLowerCase());
	return this.wrap(this.str);
}
validator.Filter.prototype.xss = function() {
	this.modify(this.str.replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/'/g, '&#39;').replace(/</g, '&lt;').replace(/>/g, '&gt;'));
	return this.wrap(this.str);
}

{'fraction_non_alphanumeric': 0.1815080177413852, 'fraction_numerical': 0.0017059024223814397, 'mean_word_length': 4.627639155470249, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 4, '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': '6559163', 'n_tokens_mistral': 1050, 'n_tokens_neox': 1064, 'n_words': 185}