不要怂,就是干,撸起袖子干!

Commit f9bb8ae6 by Kenneth Kouot

wrap options objects in optClone

1 parent c0795cf0
Showing with 3 additions and 3 deletions
...@@ -1236,7 +1236,7 @@ Model.prototype.findById = function(param, options) { ...@@ -1236,7 +1236,7 @@ Model.prototype.findById = function(param, options) {
return Promise.resolve(null); return Promise.resolve(null);
} }
options = options || {}; options = optClone(options) || {};
if (typeof param === 'number' || typeof param === 'string' || Buffer.isBuffer(param)) { if (typeof param === 'number' || typeof param === 'string' || Buffer.isBuffer(param)) {
options.where = {}; options.where = {};
...@@ -1724,7 +1724,7 @@ Model.prototype.findOrCreate = function(options) { ...@@ -1724,7 +1724,7 @@ Model.prototype.findOrCreate = function(options) {
* @return {Promise<created>} Returns a boolean indicating whether the row was created or updated. * @return {Promise<created>} Returns a boolean indicating whether the row was created or updated.
*/ */
Model.prototype.upsert = function (values, options) { Model.prototype.upsert = function (values, options) {
options = options || {}; options = optClone(options) || {};
if (!options.fields) { if (!options.fields) {
options.fields = Object.keys(this.attributes); options.fields = Object.keys(this.attributes);
...@@ -1932,7 +1932,7 @@ Model.prototype.bulkCreate = function(records, options) { ...@@ -1932,7 +1932,7 @@ Model.prototype.bulkCreate = function(records, options) {
* @see {Model#destroy} for more information * @see {Model#destroy} for more information
*/ */
Model.prototype.truncate = function(options) { Model.prototype.truncate = function(options) {
options = options || {}; options = optClone(options) || {};
options.truncate = true; options.truncate = true;
return this.destroy(options); return this.destroy(options);
}; };
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!