<commit_before>export function clone(obj)
{
	return JSON.parse(JSON.stringify(obj));
}

export function dump()
{
	Array.prototype.slice.call(arguments).map(obj => console.log(clone(obj)))
}

let context;

export function getTextWidth(text, font)
{
	// re-use canvas object for better performance
	if (!context) 
	{<commit_msg>Added string trim util<commit_after>export function clone(obj)
{
	return JSON.parse(JSON.stringify(obj));
}

export function dump()
{
	Array.prototype.slice.call(arguments).map(obj => console.log(clone(obj)))
}

export function trim (string)
{
	return String(string || '').replace(/^\s+|\s+$/g, '')
}

let context;

export function getTextWidth(text, font)
{
	// re-use canvas object for better performance
	if (!context) 
	{
{'fraction_non_alphanumeric': 0.15312916111850866, 'fraction_numerical': 0.0, 'mean_word_length': 5.163934426229508, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5272847', 'n_tokens_mistral': 248, 'n_tokens_neox': 244, 'n_words': 58}