<commit_before>/**
 * Helper kind to get the interesting informations such as
 * published properties, events, ... from the output
 * of the analyzer for a specific kind.
 *
 * First, call setDefinition() to pass the data object
 * retrieved thru analyzer.Indexer.findByName().
 */
enyo.kind({
	name: "analyzer.Analyzer.KindHelper",
	kind: "enyo.Component",
	published: {
		definition: null
	},
	/**
	 * Validate that the definition was correctly set
	 * @throws an exception if the {definition} is not set
	 * @protected
	 */
	checkDefAvail: function() {
		if ( ! this.definition) {
			throw "No definition provided";
		}
	},
	/**
	 * List the events of the kind
	 * @return a list of the event names
	 */
	getEvents: function() {
		this.checkDefAvail();
		var events = [];

		var obj = this.definition.properties;
		for (var i=0; i<obj.length; i++) {
			if (obj[i].token === "events") {
				var p = obj[i].value[0].properties;
				for (var j=0; j < p.length; j++) {
					var name = p[j].name;
					events.push(name);
				}
			}
		}
		return events;
	},
	/**
	 * List the published properties of the kind
	 * @return a list of the published property names
	 * properties
	 */
	getPublished: function() {
		this.checkDefAvail();
		var published = [];

		var obj = this.definition.properties;
		for (var i=0; i<obj.length; i++) {
			if (obj[i].token === "published") {
				var p = obj[i].value[0].properties;
				for (var j=0; j < p.length; j++) {
					var name = p[j].name;
					published.push(name);
				}
			}
		}
		return published;
	}
});<commit_msg>ENYO-2417: Add a method "getFunctions" in Analyzer.KindHelper<commit_after>/**
 * Helper kind to get the interesting informations such as
 * published properties, events, ... from the output
 * of the analyzer for a specific kind.
 *
 * First, call setDefinition() to pass the data object
 * retrieved thru analyzer.Indexer.findByName().
 */
enyo.kind({
	name: "analyzer.Analyzer.KindHelper",
	kind: "enyo.Component",
	published: {
		definition: null
	},
	/**
	 * Validate that the definition was correctly set
	 * @throws an exception if the {definition} is not set
	 * @protected
	 */
	checkDefAvail: function() {
		if ( ! this.definition) {
			throw "No definition provided";
		}
	},
	/**
	 * List the events of the kind
	 * @return a list of the event names
	 */
	getEvents: function() {
		this.checkDefAvail();
		var events = [];

		var obj = this.definition.properties;
		for (var i=0; i<obj.length; i++) {
			if (obj[i].token === "events") {
				var p = obj[i].value[0].properties;
				for (var j=0; j < p.length; j++) {
					var name = p[j].name;
					events.push(name);
				}
			}
		}
		return events;
	},
	/**
	 * List the published properties of the kind
	 * @return a list of the published property names
	 * properties
	 */
	getPublished: function() {
		this.checkDefAvail();
		var published = [];

		var obj = this.definition.properties;
		for (var i=0; i<obj.length; i++) {
			if (obj[i].token === "published") {
				var p = obj[i].value[0].properties;
				for (var j=0; j < p.length; j++) {
					var name = p[j].name;
					published.push(name);
				}
			}
		}
		return published;
	},
		/**
	 * List the functions of the kind
	 * @return a list of functions names
	 * properties
	 */
	getFunctions: function() {
		this.checkDefAvail();
		var functions = [];
		
		var obj = this.definition.properties;
		for (var i=0; i<obj.length; i++) {
			var p = obj[i];
			if (p.value[0].name === 'function') {
				functions.push(p.name);
			}
		}
		return functions;
	}
});
{'fraction_non_alphanumeric': 0.15070821529745043, 'fraction_numerical': 0.0050991501416430595, 'mean_word_length': 2.958520179372197, 'pattern_counts': {'":': 0, '<': 12, '<?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': '734928', 'n_tokens_mistral': 1334, 'n_tokens_neox': 1157, 'n_words': 357}