Skip to content

Commit

Permalink
Copy definition before modifying it
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Dobmann committed Jul 8, 2015
1 parent d808733 commit 539fccb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/Schema.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"use strict";

var processDefinition = require("./processDefinition.js"),
merge = require("./merge.js");
merge = require("./merge.js"),
clone = require("clone");

var slice = Array.prototype.slice;

Expand All @@ -25,9 +26,9 @@ Schema.prototype.constructor = function (name, definition) {
}

this.name = name;
this.definition = definition;
this.definition = clone(definition);

schema = processDefinition(definition);
schema = processDefinition(this.definition);

this.keys = schema.keys;
this.types = schema.types;
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
},
"homepage": "https://github.com/peerigon/alamid-schema",
"dependencies": {
"clone": "^1.0.2",
"value": "0.3.x"
},
"devDependencies": {
Expand Down

0 comments on commit 539fccb

Please sign in to comment.