<commit_before>var Persistence = function(table){
	this.table = table; //hold Tabulator object
	this.mode = "";
	this.id = "";
	this.persistProps = ["field", "width", "visible"];
};

// Test for whether localStorage is available for use.
Persistence.prototype.localStorageTest = function() {
    function lsTest(){
            var  testKey =  "_tabulator_test";
            try {
                    window.localStorage.setItem( testKey, testKey);
                    window.localStorage.removeItem( testKey );
                    return true;
            } catch(e) {
                    return false;
            }
        };
};

//setup parameters
Persistence.prototype.initialize = function(mode, id){
	//determine persistent layout storage type
	
	this.mode = mode !== true ?  mode : (this.localStorageTest() ? "local" : "cookie");

	//set storage tag
	this.id = "tabulator-" + (id || (this.table.element.getAttribute("id") || ""));
};

//load saved definitions
Persistence.prototype.load = function(type, current){

	var data = this.retreiveData(type);

	if(current){
		data = data ? this.mergeDefinition(current, data) : current;
	}

	return data;
};

//retreive data from memory
Persistence.prototype.retreiveData = function(type){
	var data = "",
	id = this.id + (type === "columns" ? "" : "-" + type);

	switch(this.mode){
		case "local":
		data = localStorage.getItem(id);
		break;

		case "cookie":<commit_msg>fix error in pulled in persistance module update<commit_after>var Persistence = function(table){
	this.table = table; //hold Tabulator object
	this.mode = "";
	this.id = "";
	this.persistProps = ["field", "width", "visible"];
};

// Test for whether localStorage is available for use.
Persistence.prototype.localStorageTest = function() {
	var  testKey =  "_tabulator_test";

	try {
		window.localStorage.setItem( testKey, testKey);
		window.localStorage.removeItem( testKey );
		return true;
	} catch(e) {
		return false;
	}
};

//setup parameters
Persistence.prototype.initialize = function(mode, id){
	//determine persistent layout storage type

	this.mode = mode !== true ?  mode : (this.localStorageTest() ? "local" : "cookie");

	//set storage tag
	this.id = "tabulator-" + (id || (this.table.element.getAttribute("id") || ""));
};

//load saved definitions
Persistence.prototype.load = function(type, current){

	var data = this.retreiveData(type);

	if(current){
		data = data ? this.mergeDefinition(current, data) : current;
	}

	return data;
};

//retreive data from memory
Persistence.prototype.retreiveData = function(type){
	var data = "",
	id = this.id + (type === "columns" ? "" : "-" + type);

	switch(this.mode){
		case "local":
		data = localStorage.getItem(id);
		break;

		case "cookie":
{'fraction_non_alphanumeric': 0.15207035544155367, 'fraction_numerical': 0.0, 'mean_word_length': 3.340222575516693, 'pattern_counts': {'":': 4, '<': 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': '1757674', 'n_tokens_mistral': 865, 'n_tokens_neox': 831, 'n_words': 208}