<commit_before>export function arrayUnique( values: any[] )
{
	return values.filter( ( value, index ) =>
	{
		return values.indexOf( value ) === index;
	} );
}

export function stringSort( a: string, b: string )
{
	a = a.toLowerCase();
	b = b.toLowerCase();

	if ( a < b ) {
		return -1;
	}
	else if ( a > b ) {
		return 1;
	}
	return 0;
}<commit_msg>Add an array index by helper.<commit_after>export function arrayUnique( values: any[] )
{
	return values.filter( ( value, index ) =>
	{
		return values.indexOf( value ) === index;
	} );
}

export function stringSort( a: string, b: string )
{
	a = a.toLowerCase();
	b = b.toLowerCase();

	if ( a < b ) {
		return -1;
	}
	else if ( a > b ) {
		return 1;
	}
	return 0;
}

export function arrayIndexBy<T>( values: T[], field: keyof T ): { [k: string]: T }
{
	const indexed: any = {};
	values.forEach( ( item ) => indexed[ item[ field ] + '' ] = item );
	return indexed;
}
{'fraction_non_alphanumeric': 0.17320261437908496, 'fraction_numerical': 0.006535947712418301, 'mean_word_length': 3.1772727272727272, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 9, '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': '56452', 'n_tokens_mistral': 348, 'n_tokens_neox': 340, 'n_words': 101}