<commit_before>const loki = require("lokijs");

let db = new loki("data.js");
let messages = db.addCollection("messages");

let _exports = module.exports = {};

_exports.store_message = function (msg) {
	messages.insert(msg);
}

_exports.get_messages = function (timestamp) {
	return messages.find( {"time" : {"$gte" : timestamp} } );
}<commit_msg>Add message cleaning function<commit_after>const loki = require("lokijs");

let db = new loki("data.js");
let messages = db.addCollection("messages");

let _exports = module.exports = {};

function clean_message(msg) {
	delete msg.secret;
	msg.timestamp = (new Date()).getTime() / 1000;
}

_exports.store_message = function (msg) {
	messages.insert( clean_message(msg) );
}

_exports.get_messages = function (timestamp) {
	return messages.find( {"time" : {"$gte" : timestamp} } );
}
{'fraction_non_alphanumeric': 0.1674698795180723, 'fraction_numerical': 0.004819277108433735, 'mean_word_length': 5.343511450381679, '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': '5468026', 'n_tokens_mistral': 278, 'n_tokens_neox': 272, 'n_words': 62}