From 128f6e628eeb0d2e7762de6196cf5996759a4900 Mon Sep 17 00:00:00 2001 From: Romain Beauxis Date: Mon, 23 Jan 2012 02:38:38 -0600 Subject: [PATCH] Do not modify opts in base.js, these may be globals. --- lib/fast_legs/base.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/fast_legs/base.js b/lib/fast_legs/base.js index 94d047a..125bea4 100644 --- a/lib/fast_legs/base.js +++ b/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;