Code coverage report for dist\lib\ModelSpecificInstance.js

Statements: 100% (16 / 16)      Branches: 100% (2 / 2)      Functions: 100% (7 / 7)      Lines: 100% (16 / 16)      Ignored: none     

All files » dist/lib/ » ModelSpecificInstance.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 351 1 1 26 403   26 26 53 27   35     4           26   64     8         26   1    
var util = require('util');
var _ = require('lodash');
function ModelSpecificInstance(model, instanceType) {
    var constructor = function (doc, isNew, isPartial) {
        instanceType.call(this, model, doc, isNew, isPartial);
    };
    util.inherits(constructor, instanceType);
    _.each(Object.keys(model.schema), function (property) {
        if (model.transforms.hasOwnProperty(property)) {
            return Object.defineProperty(constructor.prototype, property, {
                get: function () {
                    return model.transforms[property].fromDB(this._modified[property]);
                },
                set: function (value) {
                    this._modified[property] = model.transforms[property].toDB(value);
                },
                enumerable: true,
                configurable: true
            });
        }
        Object.defineProperty(constructor.prototype, property, {
            get: function () {
                return this._modified[property];
            },
            set: function (value) {
                this._modified[property] = value;
            },
            enumerable: true
        });
    });
    return constructor;
}
exports.default = ModelSpecificInstance;
 
//# sourceMappingURL=../lib/ModelSpecificInstance.js.map