<commit_before>define([
    'underscore',
    'backbone',
    'lib/sync-machine'
], function(
    _,
    Backbone,
    SyncMachine
) {
    'use strict';

    return Backbone.Model.extend({
        initialize : function()
        {
            _.extend(Backbone.Model.prototype, SyncMachine);

            Backbone.Model.prototype.initialize.apply(this, arguments);
        },

        sync : function(method, model, options)
        {
            var token = window.token;

            options.headers = options.headers || {};

            _.extend(options.headers, this.defaultHeaders());

            return Backbone.Model.prototype.sync.call(this, method, model, options);
        },

        defaultHeaders : function()
        {
            var token = window.app.storage.get('token');
            var headers;

            headers = {
                Accept         : 'application/json',
                'Content-Type' : 'application/json'
            };

            if (token)
            {
                headers = _.extend(headers, {
                    Authorization: 'Bearer '+token.access_token
                });
            }<commit_msg>save options as this.options in base model<commit_after>define([
    'underscore',
    'backbone',
    'lib/sync-machine'
], function(
    _,
    Backbone,
    SyncMachine
) {
    'use strict';

    return Backbone.Model.extend({
        initialize : function(attributes, options)
        {
            _.extend(Backbone.Model.prototype, SyncMachine);

            Backbone.Model.prototype.initialize.apply(this, arguments);
            
            this.options = options || {};
        },

        sync : function(method, model, options)
        {
            var token = window.token;

            options.headers = options.headers || {};

            _.extend(options.headers, this.defaultHeaders());

            return Backbone.Model.prototype.sync.call(this, method, model, options);
        },

        defaultHeaders : function()
        {
            var token = window.app.storage.get('token');
            var headers;

            headers = {
                Accept         : 'application/json',
                'Content-Type' : 'application/json'
            };

            if (token)
            {
                headers = _.extend(headers, {
                    Authorization: 'Bearer '+token.access_token
                });
            }
{'fraction_non_alphanumeric': 0.1157196184155952, 'fraction_numerical': 0.0, 'mean_word_length': 1.5125, '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': '4118245', 'n_tokens_mistral': 630, 'n_tokens_neox': 592, 'n_words': 113}