<commit_before>// Copyright 2014, Renasar Technologies Inc.
/* jshint node: true */

'use strict';

var di = require('di');

module.exports = SerializableFactory;

di.annotate(SerializableFactory, new di.Provide('Serializable'));
di.annotate(SerializableFactory,
    new di.Inject(
        'Q',
        'Assert',
        'Util',
        'Validatable',
        '_'
    )
);

function SerializableFactory (Q, assert, util, Validatable, _) {
    function Serializable(schema, defaults) {
        Validatable.call(this, schema);

        _.defaults(this, defaults);
    }

    util.inherits(Serializable, Validatable);

    Serializable.register = function (factory, constructor) {
        constructor.provides = util.provides(factory);
    };

    Serializable.prototype.serialize = function (target) {
        target = target || this;

        return Q.resolve()
            .then(function() {
                return _.cloneDeep(target)
            });
    };

    Serializable.prototype.deserialize = function (target) {
        _.defaults(this, target || {});

        return Q.resolve(this);
    };

    return Serializable;
}<commit_msg>fix lint error in serializable<commit_after>// Copyright 2014, Renasar Technologies Inc.
/* jshint node: true */

'use strict';

var di = require('di');

module.exports = SerializableFactory;

di.annotate(SerializableFactory, new di.Provide('Serializable'));
di.annotate(SerializableFactory,
    new di.Inject(
        'Q',
        'Assert',
        'Util',
        'Validatable',
        '_'
    )
);

function SerializableFactory (Q, assert, util, Validatable, _) {
    function Serializable(schema, defaults) {
        Validatable.call(this, schema);

        _.defaults(this, defaults);
    }

    util.inherits(Serializable, Validatable);

    Serializable.register = function (factory, constructor) {
        constructor.provides = util.provides(factory);
    };

    Serializable.prototype.serialize = function (target) {
        target = target || this;

        return Q.resolve()
            .then(function() {
                return _.cloneDeep(target);
            });
    };

    Serializable.prototype.deserialize = function (target) {
        _.defaults(this, target || {});

        return Q.resolve(this);
    };

    return Serializable;
}
{'fraction_non_alphanumeric': 0.12761324041811847, 'fraction_numerical': 0.003484320557491289, 'mean_word_length': 2.6059654631083204, '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': '90096', 'n_tokens_mistral': 661, 'n_tokens_neox': 635, 'n_words': 138}