<commit_before>#ifndef _MODEL_STORAGE
#define _MODEL_STORAGE
/**
 * Storage prototype - Interface for setting and getting permanent data
 * uso-app-framework
 */

var ModelStorage = new Class({
	Extends: Model,
	constructor: ModelStorage,
	construct: function() {
		this._dataTypes = JSON.parse( GM_getValue( 'ModelStorageGM/dataTypes', '{}' ) );
	},
	_dataTypes: {},
	get: function( name, defaultValue ) {
		switch ( this._dataTypes[ name ] ) {
			case 'object':
				var ret = JSON.parse( GM_getValue( name, 'null' ) );
				if ( null === ret )
					return defaultValue;
				return ret;
		}
		return GM_getValue( name, defaultValue );
	},
	set: function ( name, value ) {
		this._dataTypes[ name ] = this._getDataType( value );
		GM_setValue( 'ModelStorageGM/dataTypes', JSON.stringify( value ) );
		switch ( this._dataTypes[ name ] ) {
			case 'object':
				value = JSON.stringify( value );
				return GM_setValue( name, value );
		}
		return GM_setValue( name, value );
	},
	_getDataType: function( data ) {
		return typeof data;
	}
});
#endif
<commit_msg>Reparing and re-authoring storage model<commit_after>#ifndef _MODEL_STORAGE
#define _MODEL_STORAGE
/**
 * Storage prototype - Interface for setting and getting permanent data
 * uso-app-framework
 */

var ModelStorage = new Class({
	Extends: Model,
	constructor: ModelStorage,
	get: function( name, defaultValue ) {
		try {
			var ret = JSON.parse( GM_getValue( name, 'null' ) );
		} catch ( error ) {
			throw new Error( 'ModelStorage.prototype.get: Could not parse value. ' + error.toString() );
		}

		if ( null === ret )
			ret = defaultValue;
		return ret;
	},
	set: function ( name, value ) {
		try {
			return GM_setValue( name, JSON.stringify( value ) );
		} catch ( error ) {
			throw new Error( 'ModelStorage.prototype.set: Could not set value. ' + error.toString() );
		}
	}
});
#endif

{'fraction_non_alphanumeric': 0.13315363881401618, 'fraction_numerical': 0.0, 'mean_word_length': 3.6516290726817044, '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': '3551693', 'n_tokens_mistral': 647, 'n_tokens_neox': 600, 'n_words': 167}