<commit_before>define(function() {

    /**
     * @constructor
     */
    function Model(config) {
        if (typeof localStorage !== "object") {
            alert("localStorage is unavailable");
        }
        config = (typeof config !== "object") ? {} : config;
        config = $.extend(true, {
            "db": {
                "name": "factorQuadratics",
                "type": "localStorage"
            },
            "model": {
                "hints": "on"
            }
        }, config);
        var model = {};

        /** @private */
        function initialize () {
            this.read();
            model = $.extend(true, config.model, model);
            this._old = false;
        }

        // warning, objects are passed by reference.
        this.set = function(key, val) {
            model[key] = val;
            this._old = true;
        };

        this.get = function(key) {
            return model[key];
        };

        this.save = function() {
            this._old = false;
            localStorage[config.db.name] = JSON.stringify(model);
        };

        this.read = function() {
            if (undefined === localStorage[config.db.name]) { return model; }
            model = JSON.parse(localStorage[config.db.name]);
            return model;
        };

        this.write = function() {
            if (arguments.length===0) { return this.save(); }
            this.set.apply(this, arguments);
            this.save();
        };

        this.increment = function(key) {
            this.set(key, this.get(key) + 1);
        };

        this.dump = function() {
            model = {};
            delete localStorage[config.db.name];
        };

        initialize.call(this);
    }
    return Model;
});<commit_msg>initialize score to 0 and parseInt when necessary<commit_after>define(function() {

    /**
     * @constructor
     */
    function Model(config) {
        if (typeof localStorage !== "object") {
            alert("localStorage is unavailable");
        }
        config = (typeof config !== "object") ? {} : config;
        config = $.extend(true, {
            "db": {
                "name": "factorQuadratics",
                "type": "localStorage"
            },
            "model": {
                "hints": "on",
                "score": 0
            }
        }, config);
        var model = {};

        /** @private */
        function initialize () {
            this.read();
            model = $.extend(true, config.model, model);
            this._old = false;
        }

        // warning, objects are passed by reference.
        this.set = function(key, val) {
            model[key] = val;
            this._old = true;
        };

        this.get = function(key) {
            return model[key];
        };

        this.save = function() {
            this._old = false;
            localStorage[config.db.name] = JSON.stringify(model);
        };

        this.read = function() {
            if (undefined === localStorage[config.db.name]) { return model; }
            model = JSON.parse(localStorage[config.db.name]);
            return model;
        };

        this.write = function() {
            if (arguments.length===0) { return this.save(); }
            this.set.apply(this, arguments);
            this.save();
        };

        this.increment = function(key) {
            this.set(key, parseInt(this.get(key)) + 1);
        };

        this.dump = function() {
            model = {};
            delete localStorage[config.db.name];
        };

        initialize.call(this);
    }
    return Model;
});
{'fraction_non_alphanumeric': 0.14396028681742967, 'fraction_numerical': 0.001654715940430226, 'mean_word_length': 1.3861842105263158, 'pattern_counts': {'":': 11, '<': 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': '2036054', 'n_tokens_mistral': 983, 'n_tokens_neox': 953, 'n_words': 199}