<commit_before>function Callbacks(context) {
	if (context) {
		this._context = context;
		this._types = {};
	}
}

Callbacks.prototype = {

	_context: null,

	_types: null,

	add: function add(name, method) {
		if (!this._types[name]) {
			this._types[name] = [];
		}

		this._types[name].push(method);
	},

	execute: function execute(name) {
		if (!this._types[name]) {
			return true;
		}

		var args = Array.prototype.splice.call(arguments, 1, arguments.length);
		var method, i = 0, length = this._types[name].length;
		var success = true;

		for (i; i < length; i++) {
			method = this._types[name][i];

			if (!this._context[method]) {
				throw new Error("No callback method found: " + method);
			}

			if (this._context[method].apply(this._context, args) === false) {
				success = false;
				break;
			}
		}

		return success;
	},

	remove: function remove(name, method) {
		if (!this._types[name]) {
			return;
		}

		var i = 0, length = this._types[name].length, m;

		for (i; i < length; i++) {
			if (method === this._types[name][i]) {
				this._types[name].splice(i, 1);
				break;
			}
		}
	}

};<commit_msg>Returning 'this' after #add() and #remove() methods are called.<commit_after>function Callbacks(context) {
	if (context) {
		this._context = context;
		this._types = {};
	}
}

Callbacks.prototype = {

	_context: null,

	_types: null,

	add: function add(name, method) {
		if (!this._types[name]) {
			this._types[name] = [];
		}

		this._types[name].push(method);

		return this;
	},

	execute: function execute(name) {
		if (!this._types[name]) {
			return true;
		}

		var args = Array.prototype.splice.call(arguments, 1, arguments.length);
		var method, i = 0, length = this._types[name].length;
		var success = true;

		for (i; i < length; i++) {
			method = this._types[name][i];

			if (!this._context[method]) {
				throw new Error("No callback method found: " + method);
			}

			if (this._context[method].apply(this._context, args) === false) {
				success = false;
				break;
			}
		}

		return success;
	},

	remove: function remove(name, method) {
		if (!this._types[name]) {
			return;
		}

		var i = 0, length = this._types[name].length, m;

		for (i; i < length; i++) {
			if (method === this._types[name][i]) {
				this._types[name].splice(i, 1);
				break;
			}
		}

		return this;
	}

};
{'fraction_non_alphanumeric': 0.17396907216494845, 'fraction_numerical': 0.003436426116838488, 'mean_word_length': 3.114840989399293, 'pattern_counts': {'":': 0, '<': 7, '<?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': '6463339', 'n_tokens_mistral': 970, 'n_tokens_neox': 825, 'n_words': 192}