<commit_before>// OpenWrap v2
// Author: <EMAIL>
// Template

OpenWrap.template = function() {
	//loadHandlebars();
	if (isUnDef(this.hb)) {
		this.hb = getOpenAFJar() + "::js/handlebars.js";
		require(this.hb);
	}
	return ow.template;
}

/**
 * <odoc>
 * <key>ow.template.addHelpers(aPrefix, aObject)</key>
 * Registers all aObject functions as helpers. These helpers identifier will be composed by aPrefix + Name of the each function.
 * \
 * (available after ow.loadTemplate())
 * </odoc>
 */
OpenWrap.template.prototype.addHelpers = function(aPrefix, aObject) {
	var m = Object.keys(aObject.constructor.prototype);
	if (m.length < 1) m = Object.keys(aObject.prototype);
	m.forEach(function(aMethod) {
		require(this.hb).registerHelper(aPrefix + aMethod, aObject[aMethod]);
	});
}

/**
 * <odoc>
 * <key>ow.template.addFormatHelpers()</key>
 * Adds all functions of ow.format as helpers with the prefix owFormat_.<commit_msg>error on ow.templates.addFormatHelpers where this.hb was undefined for require<commit_after>// OpenWrap v2
// Author: <EMAIL>
// Template

OpenWrap.template = function() {
	//loadHandlebars();
	if (isUnDef(this.hb)) {
		this.hb = getOpenAFJar() + "::js/handlebars.js";
		require(this.hb);
	}
	return ow.template;
}

/**
 * <odoc>
 * <key>ow.template.addHelpers(aPrefix, aObject)</key>
 * Registers all aObject functions as helpers. These helpers identifier will be composed by aPrefix + Name of the each function.
 * \
 * (available after ow.loadTemplate())
 * </odoc>
 */
OpenWrap.template.prototype.addHelpers = function(aPrefix, aObject) {
	var m = Object.keys(aObject.constructor.prototype);
	if (m.length < 1) m = Object.keys(aObject.prototype);
	m.forEach((aMethod) => {
		require(this.hb).registerHelper(aPrefix + aMethod, aObject[aMethod]);
	});
}

/**
 * <odoc>
 * <key>ow.template.addFormatHelpers()</key>
 * Adds all functions of ow.format as helpers with the prefix owFormat_.
{'fraction_non_alphanumeric': 0.15605427974947808, 'fraction_numerical': 0.0020876826722338203, 'mean_word_length': 4.369747899159663, 'pattern_counts': {'":': 2, '<': 21, '<?xml version=': 0, '>': 20, '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': '4471204', 'n_tokens_mistral': 674, 'n_tokens_neox': 652, 'n_words': 149}