<commit_before>import ECT from 'ect';

let renderer;

export function init({ root }) {
	renderer = ECT({
		ext: '.ect',
		root
	});
}

export default function render(filepath, locals) {
	if (!renderer) {
		throw new Error('ECT should be initialized with template.init().');
	}
	return renderer.render(filepath, locals);
}<commit_msg>Initialize template engine with default options by default.<commit_after>import ECT from 'ect';
import _ from 'lodash';

const defaultOptions = {
	ext: '.ect',
	root: 'templates'
};

let renderer;

export function init(options = {}) {
	renderer = ECT(_.merge({}, defaultOptions, options));
}

export default function render(filepath, locals) {
	if (!renderer) {
		init();
	}
	return renderer.render(filepath, locals);
}
{'fraction_non_alphanumeric': 0.1422872340425532, 'fraction_numerical': 0.0, 'mean_word_length': 4.8828125, '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': '6489590', 'n_tokens_mistral': 241, 'n_tokens_neox': 240, 'n_words': 73}