Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
from
Jump to file or symbol
Failed to load files and symbols.
+5 −0
Split
View
@@ -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;