<commit_before>/**
 * @class yootil.extension
 * @static
 *
 * Helper methods for plugin extensions.
 *
 *     yootil.extension.create("monetary", "test_money", class {
 *
 *         static init(){
 *             console.log("init");
 *         }
 *
 *         static pre_init(){
 *	           console.log("pre");
 *         }
 *
 *         static post_init(){
 *	           console.log("post");
 *         }
 *
 *         static ready(){
 *	           console.log("ready");
 *         }
 *
 *     });
 *
 * The main plugin that supports extensions can then run any
 * pre, init, post, and ready events at the correct place in
 * the plugin.
 *
 *     yootil.extension.run("monetary").inits();
 *
 */

yootil.extension = (class {

	static init(){
		this._plugin_extensions = new Map();

		return this;
	}

	/**
	 * Creates an extension for an existing plugin.
	 *
	 * @param {String} plugin The name of the plugin this extension is for.
	 * @param {String} ext_key The name of your extension plugin.
	 * @param {Object} klass The klass that contains methods to execute.
	 */

	static create(plugin = "", ext_key = "", klass = null){
		if(!plugin || !key || !klass){
			return;
		}

		let plugin_name = plugin.toUpperCase() + "_EXTENSIONS";
		let ext_name = ext_key.toUpperCase();

		if(!this._plugin_extensions.has(plugin_name)){
			this._plugin_extensions.set(plugin_name, new Map());
		}

		this._plugin_extensions.get(plugin_name).set(ext_name, klass);

		return this;
	}

	/**
	 * For plugins to run various methods on extension classes.<commit_msg>Param change to object<commit_after>/**
 * @class yootil.extension
 * @static
 *
 * Helper methods for plugin extensions.
 *
 *     yootil.extension.create({
 *
 *         plugin: "monetary",
 *         id: "test_money",
 *         handlers: {
 *
 *              init(){
 *                  console.log("init");
 *              }
 *
 *              pre_init(){
 *     	           console.log("pre");
 *              }
 *
 *              post_init(){
 *	                console.log("post");
 *              }
 *
 *              ready(){
 *	                console.log("ready");
 *              }
 *              
 *         }
 *
 *     });
 *
 * The main plugin that supports extensions can then run any
 * pre, init, post, and ready events at the correct place in
 * the plugin.
 *
 *     yootil.extension.run("monetary").inits();
 *
 */

yootil.extension = (class {

	static init(){
		this._plugin_extensions = new Map();

		return this;
	}

	/**
	 * Creates an extension for an existing plugin.
	 *
	 * @param {String} plugin The name of the plugin this extension is for.
	 * @param {String} id The name of your extension plugin.
	 * @param {Object} handlers The handlers will be executed.
	 */

	static create({plugin = "", id = "", handlers = null} = {}){
		if(!plugin || !key || !handlers){
			return;
		}

		let plugin_name = plugin.toString().toUpperCase() + "_EXTENSIONS";
		let id_name = id.toString().toUpperCase();

		if(!this._plugin_extensions.has(plugin_name)){
			this._plugin_extensions.set(plugin_name, new Map());
		}

		this._plugin_extensions.get(plugin_name).set(id_name, handlers);

		return this;
	}

	/**
	 * For plugins to run various methods on extension classes.
{'fraction_non_alphanumeric': 0.1406539173349784, 'fraction_numerical': 0.0, 'mean_word_length': 2.275757575757576, 'pattern_counts': {'":': 0, '<': 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': '7173507', 'n_tokens_mistral': 1026, 'n_tokens_neox': 959, 'n_words': 255}