<commit_before>$(function() {
	if (typeof events == "undefined") return;

	var fillFormWithEvent = function fillFormWithEvent(event) {
		$.each(event, function(key, val) {
			$("#event_" + key).val(val);
		});
	};

	var tokens = $.map(events, function(elm) {
		var e = elm.event;
		e.displayName = e.non_billig_title_no + " " + e.created_at;
		return e; 
	});

	$(".typeahead")
	.typeahead({
		name: "events",
		local: tokens,<commit_msg>autocomplete when creating from old event<commit_after>$(function() {
	if (typeof events == "undefined") return;

	var fillFormWithEvent = function fillFormWithEvent(event) {
		$.each(event, function(key, val) {
			$("#event_" + key).val(val);
		});
	};

	var tokens = $.map(events, function(event) {
	  console.log(typeof(event));
	  console.log(event);
		event.displayName = event.non_billig_title_no + " - " + new Date(event.created_at).toDateString();
		return event;
	});

	$(".typeahead")
	.typeahead({
		name: "events",
		local: tokens,
{'fraction_non_alphanumeric': 0.18042813455657492, 'fraction_numerical': 0.0, 'mean_word_length': 4.336956521739131, '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': '5136520', 'n_tokens_mistral': 376, 'n_tokens_neox': 342, 'n_words': 70}