Code coverage report for src/Common/Schema/Mixins/SchemaClone.js

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

All files » src/Common/Schema/Mixins/ » SchemaClone.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 35 36 37 38 39 40 41 42      1                     1                     1   36     36     36           1    
"use strict";
 
 
var _                 = require("lodash"),
    Assert            = require("../../Assert"),
    Types             = require("../Types");
 
/**
 *
 * Schema clone methods
 *
 * @type {Object}
 *
 */
var SchemaClone = function(Class){
 
    /**
     *
     * Clone the current schema. If `options` is defined it will override the
     * current instance data of the new SchemaDefinition.
     * 
     * @param  {Object} options
     * @return {Class}
     * 
     */
    this.clone = function(options){
 
        Assert.instanceOf(Types.SchemaDefinition)
            .assert(this);
 
        var instance = new Class(
            _.extend({}, this, options));
 
        return instance;
 
    };
 
};
 
module.exports = SchemaClone;