<commit_before>var mithril = require("mithril");

MITHRIL_REQUEST_OPTS = ["user", "password", "data", "background", "initialValue", "unwrapSuccess", "unwrapError", "serialize", "extract", "type"]

var Model = function(options) {
    this._setOptions(options || {});
};

Model.prototype._setOptions = function(options) {
    for(var key in options) {
        this[key] = options[key];
    }
};

Model.prototype.xhrConfig = function(xhr) {
    return 
};

Model.prototype._getUrl = function() {
    return typeof this.url === "function" ? this.url() : this.url;
};

Model.prototype._request = function(method, options) {
    var url = this._getUrl();
    var requestOpts = {method: method, url: url, config: this.xhrConfig};

    for(var key in options) {
        if(MITHRIL_REQUEST_OPTS.indexOf(key) !== -1) {
            requestOpts[key] = options[key];
        }
    }

    mithril.request(requestOpts)
        .then(function(response) {
            options.success(response)
        }, function(error) {
            if(options.error) {options.error(error)}
        })
};

Model.prototype.get = function(options) {
    var opts = this._request("GET", options);
};

Model.prototype.save = function(options) {
    var requestType = this.id ? "PUT" : "POST"
    opts = this._request(requestType, options)
};

module.exports = {
    Model: Model<commit_msg>added delete method to model base<commit_after>var mithril = require("mithril");

MITHRIL_REQUEST_OPTS = ["user", "password", "data", "background", "initialValue", "unwrapSuccess", "unwrapError", "serialize", "extract", "type"]

var Model = function(options) {
    this._setOptions(options || {});
};

Model.prototype._setOptions = function(options) {
    for(var key in options) {
        this[key] = options[key];
    }
};

Model.prototype.xhrConfig = function(xhr) {
    return 
};

Model.prototype._getUrl = function() {
    return typeof this.url === "function" ? this.url() : this.url;
};

Model.prototype._request = function(method, options) {
    var url = this._getUrl();
    var requestOpts = {method: method, url: url, config: this.xhrConfig};

    for(var key in options) {
        if(MITHRIL_REQUEST_OPTS.indexOf(key) !== -1) {
            requestOpts[key] = options[key];
        }
    }

    mithril.request(requestOpts)
        .then(function(response) {
            options.success(response)
        }, function(error) {
            if(options.error) {options.error(error)}
        })
};

Model.prototype.delete = function(options) {
    this._request("DELETE", options)
}

Model.prototype.get = function(options) {
    this._request("GET", options);
};

Model.prototype.save = function(options) {
    var requestType = this.id ? "PUT" : "POST"
    this._request(requestType, options)
};

module.exports = {
    Model: Model
{'fraction_non_alphanumeric': 0.15706618962432917, 'fraction_numerical': 0.0007155635062611807, 'mean_word_length': 3.341614906832298, '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': '2428158', 'n_tokens_mistral': 876, 'n_tokens_neox': 881, 'n_words': 173}