<commit_before>app.service('databaseLanguage', function(database)
{
	this.ref = function()
	{
		return database.ref('languages')
	}

	this.root = function()
	{
		return database.ref('languages')
	}

	this.rootLive = function(callback)
	{
		this.root().on('value', snap =>
		{	
			callback(this.fromSnap(snap))
		})
	}

	this.rootStatic = function(callback)
	{
		this.root().once('value', snap =>
		{	
			callback(this.fromSnap(snap))
		})
	}

	this.fromSnap = function(snap)
	{
		const languages = {}

		snap.forEach(function(entry)
		{
			languages[entry.key] = new Language(entry.key, entry.val())
		})

		return languages
	}

	this.add = function(value)
	{
		return database.push('languages', value)
	}

	this.update = function(id, value)
	{
		return database.set(languagePath(id), value)
	}

	this.remove = function(id)
	{
		return database.remove(languagePath(id))
	}

	function languagePath(languageId)
	{
		return `languages/${languageId}`
	}
})<commit_msg>Code cleanup<commit_after>app.service('databaseLanguage', function(database)
{
	this.rootLive = function(callback)
	{
		root().on('value', snap =>
		{	
			callback(fromSnap(snap))
		})
	}

	this.rootStatic = function(callback)
	{
		root().once('value', snap =>
		{	
			callback(fromSnap(snap))
		})
	}

	this.add = function(value)
	{
		return database.push('languages', value)
	}

	this.update = function(id, value)
	{
		return database.set(languagePath(id), value)
	}

	this.remove = function(id)
	{
		return database.remove(languagePath(id))
	}

	// =========================================================================

	function root()
	{
		return database.ref('languages')
	}

	function fromSnap(snap)
	{
		const languages = {}

		snap.forEach(function(entry)
		{
			languages[entry.key] = new Language(entry.key, entry.val())
		})

		return languages
	}

	function languagePath(languageId)
	{
		return `languages/${languageId}`
	}
})
{'fraction_non_alphanumeric': 0.19297325642370214, 'fraction_numerical': 0.0, 'mean_word_length': 4.088, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '7377564', 'n_tokens_mistral': 728, 'n_tokens_neox': 662, 'n_words': 97}