<commit_before>(function (factory) {
    'use strict';
    
    if (typeof define === 'function' && define.amd) {
        define(['backbone', 'lodash'], factory);
    }
    else if (typeof exports !== 'undefined') {
        module.exports = exports = factory(require('backbone'), require('lodash'));
    }
    else {
        factory(Backbone, _);
    }
})(function (Backbone, _) {
    'use strict';
    
    var syncMethods = {
        
        // Overwrites object store with current instance data.
        create: function (instance, options, deferred) {
            if (instance instanceof Backbone.Model) {
                // Set the instance `idAttribute` to the `syncKey` so that `isNew()` behaves as expected.
                instance.set(instance.idAttribute, _.result(this, 'syncKey'));
            }

            var json = instance.toJSON();
            var data = JSON.stringify(json);
            this._syncSet(data);

            options.success.call(options.context, instance, json, options);
            deferred.resolve(json);
        },
        
        // Returns the parsed JSON of the object store.
        read: function (instance, options, deferred) {
            var data = this._syncGet();
            if (!data) {
                // Can't parse empty value as json. 
                options.error.call(options.context, json);
                deferred.reject(data);
                return;
            }

            var json = JSON.parse(data);

            options.success.call(options.context, json);
            deferred.resolve(json);
        },
        
        // Merges object store with current instance data.
        update: function (instance, options, deferred) {
            var defaultStr = instance instanceof Backbone.Model ? JSON.stringify({}) : JSON.stringify([]),
                storedData = this._syncGet() || defaultStr,
                json = _.merge(JSON.parse(storedData), instance.toJSON());<commit_msg>Fix incorrect arguments being passed to success()<commit_after>(function (factory) {
    'use strict';
    
    if (typeof define === 'function' && define.amd) {
        define(['backbone', 'lodash'], factory);
    }
    else if (typeof exports !== 'undefined') {
        module.exports = exports = factory(require('backbone'), require('lodash'));
    }
    else {
        factory(Backbone, _);
    }
})(function (Backbone, _) {
    'use strict';
    
    var syncMethods = {
        
        // Overwrites object store with current instance data.
        create: function (instance, options, deferred) {
            if (instance instanceof Backbone.Model) {
                // Set the instance `idAttribute` to the `syncKey` so that `isNew()` behaves as expected.
                instance.set(instance.idAttribute, _.result(this, 'syncKey'));
            }

            var json = instance.toJSON();
            var data = JSON.stringify(json);
            this._syncSet(data);

            options.success.call(options.context, json);
            deferred.resolve(json);
        },
        
        // Returns the parsed JSON of the object store.
        read: function (instance, options, deferred) {
            var data = this._syncGet();
            if (!data) {
                // Can't parse empty value as json. 
                options.error.call(options.context, json);
                deferred.reject(data);
                return;
            }

            var json = JSON.parse(data);

            options.success.call(options.context, json);
            deferred.resolve(json);
        },
        
        // Merges object store with current instance data.
        update: function (instance, options, deferred) {
            var defaultStr = instance instanceof Backbone.Model ? JSON.stringify({}) : JSON.stringify([]),
                storedData = this._syncGet() || defaultStr,
                json = _.merge(JSON.parse(storedData), instance.toJSON());
{'fraction_non_alphanumeric': 0.12076433121019109, 'fraction_numerical': 0.0, 'mean_word_length': 1.880410858400587, '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': '6166461', 'n_tokens_mistral': 1018, 'n_tokens_neox': 977, 'n_words': 267}