<commit_before>export function addDaysToDate(date: string, count: number): string {
	const d = new Date(date);
	d.setDate(d.getDate() + count);
	return formatDate(d);
}

export function subtractDaysFromDate(date: string, count: number): string {
	const d = new Date(date);
	d.setDate(d.getDate() - count);
	return formatDate(d);
}

/** Utility function to create a K:V from a list of strings */
export function listToEnum<T extends string>(o: T[]): {[K in T]: K} {
	return o.reduce((res, key) => {
		res[key] = key;
		return res;
	}, Object.create(null));
}

function formatDate(inputDate: Date): string {
	const day: string = ('0' + inputDate.getDate()).slice(-2);
	const month: string = ('0' + (inputDate.getMonth() + 1)).slice(-2);
	const year: string = inputDate.getFullYear().toString();
	return [year, month, day].join('-');
}

/**
 * See {@link https://gist.github.com/tristanlins/6585391}
 */<commit_msg>utils: Sleep added to utils for await sleep(...)<commit_after>export function addDaysToDate(date: string, count: number): string {
	const d = new Date(date);
	d.setDate(d.getDate() + count);
	return formatDate(d);
}

export function sleep(ms: number): Promise<void> {
	return new Promise<void>((resolve) => setTimeout(resolve, ms));
}

export function subtractDaysFromDate(date: string, count: number): string {
	const d = new Date(date);
	d.setDate(d.getDate() - count);
	return formatDate(d);
}

/** Utility function to create a K:V from a list of strings */
export function listToEnum<T extends string>(o: T[]): {[K in T]: K} {
	return o.reduce((res, key) => {
		res[key] = key;
		return res;
	}, Object.create(null));
}

function formatDate(inputDate: Date): string {
	const day: string = ('0' + inputDate.getDate()).slice(-2);
	const month: string = ('0' + (inputDate.getMonth() + 1)).slice(-2);
	const year: string = inputDate.getFullYear().toString();
	return [year, month, day].join('-');
}

/**
 * See {@link https://gist.github.com/tristanlins/6585391}
 */
{'fraction_non_alphanumeric': 0.17997977755308392, 'fraction_numerical': 0.012133468149646108, 'mean_word_length': 4.719653179190751, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 10, 'https://': 2, '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': '6228246', 'n_tokens_mistral': 694, 'n_tokens_neox': 673, 'n_words': 187}