<commit_before>/*
 * PubSub.js by <NAME>
 * https://github.com/cosmicflame/pubsub.js
 * Released under the MIT license
 */
; (function (root, factory) {
	if (typeof define === 'function' && define.amd) {
		// AMD. Register as an anonymous module.
		define([], factory);
	} else {
		// Browser globals
		root.pubsub = factory();
	}
}(this, function () {
	var PubSub = function() {

		var subscribers = {}

		/**
		 * Publish an event.
		 * @param eventName  The string name of the event.
		 * @param data  Data object to pass to subscribers.  Can be undefined.
		 */
		this.pub = function(eventName, data) {
			if (eventName && typeof eventName === 'string') {
				data = data || {}
				if (subscribers.hasOwnProperty(eventName)) {
					subscribers[eventName].forEach(function(callback) {
						callback(data)
					})
				}
			} else {
				throw new Error('pubsub.pub requires a string and an optional function')
			}
		}

		/**
		 * Subscribe to an event.
		 * @param event  The string name of the event to listen for.
		 * @param callback  Function to call when event happens.
		 * Will be passed data object.
		 */
		this.sub = function(event, callback) {
			if (event
				&& callback
				&& typeof event === 'string'
				&& typeof callback === 'function')
			{
				if (!subscribers.hasOwnProperty(event)) {
					subscribers[event] = []
				}
				if (subscribers[event].indexOf(callback) === -1) {
					subscribers[event].push(callback)
				}
			} else {
				throw new Error('pubsub.sub requires a string and a function')
			}
		}

		this.unsub = function(event, callback) {
			if (event
				&& callback
				&& typeof event === 'string'<commit_msg>Add missing documentation to unsub()<commit_after>/*
 * PubSub.js by <NAME>
 * https://github.com/cosmicflame/pubsub.js
 * Released under the MIT license
 */
; (function (root, factory) {
	if (typeof define === 'function' && define.amd) {
		// AMD. Register as an anonymous module.
		define([], factory);
	} else {
		// Browser globals
		root.pubsub = factory();
	}
}(this, function () {
	var PubSub = function() {

		var subscribers = {}

		/**
		 * Publish an event.
		 * @param eventName  The string name of the event.
		 * @param data  Data object to pass to subscribers.  Can be undefined.
		 */
		this.pub = function(eventName, data) {
			if (eventName && typeof eventName === 'string') {
				data = data || {}
				if (subscribers.hasOwnProperty(eventName)) {
					subscribers[eventName].forEach(function(callback) {
						callback(data)
					})
				}
			} else {
				throw new Error('pubsub.pub requires a string and an optional function')
			}
		}

		/**
		 * Subscribe to an event.
		 * @param event  The string name of the event to listen for.
		 * @param callback  Function to call when event happens.
		 * Will be passed data object.
		 */
		this.sub = function(event, callback) {
			if (event
				&& callback
				&& typeof event === 'string'
				&& typeof callback === 'function')
			{
				if (!subscribers.hasOwnProperty(event)) {
					subscribers[event] = []
				}
				if (subscribers[event].indexOf(callback) === -1) {
					subscribers[event].push(callback)
				}
			} else {
				throw new Error('pubsub.sub requires a string and a function')
			}
		}

		/**
		 * Unsubscribe from an event
		 * @param event  The string name of the event to unsubscribe from.
		 * @param callback  Function that's currently subscribed to event and should be unsubscribed
		 */
		this.unsub = function(event, callback) {
			if (event
				&& callback
				&& typeof event === 'string'
{'fraction_non_alphanumeric': 0.13314447592067988, 'fraction_numerical': 0.0005665722379603399, 'mean_word_length': 2.804956896551724, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '5765645', 'n_tokens_mistral': 1302, 'n_tokens_neox': 1061, 'n_words': 332}