Browse files

Do not modify opts in base.js, these may be globals.

  • Loading branch information...
1 parent 6561679 commit 128f6e628eeb0d2e7762de6196cf5996759a4900 @toots committed Jan 23, 2012
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/fast_legs/base.js
View
5 lib/fast_legs/base.js
@@ -22,6 +22,8 @@ Base.prototype.truncate = function(opts, callback) {
if (typeof opts === 'function') {
callback = opts;
opts = {};
+ } else {
+ opts = _.clone(opts);
}
var truncateStatement = Statements.truncate(this, opts);
@@ -53,6 +55,9 @@ Base.prototype.create = function(obj, callback) {
if (_.isFunction(opts)) {
callback = opts;
opts = {};
+ } else {
+ /* Do not modify opts, which may be global. */
+ opts = _.clone(opts);
}
if (finder === 'findOne') opts.limit = 1;

0 comments on commit 128f6e6

Please sign in to comment.