From 4507857357e4546a219a7b6ab2338666773a8bc0 Mon Sep 17 00:00:00 2001 From: Benjamin Pannell Date: Thu, 11 Jun 2015 10:55:06 +0200 Subject: [PATCH] Cleaning up some code in Model to meet coding standards --- lib/Model.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/Model.ts b/lib/Model.ts index 91d7db1..74c9135 100644 --- a/lib/Model.ts +++ b/lib/Model.ts @@ -230,7 +230,7 @@ export default class Model implement if (!_.isPlainObject(conditions)) conditions = { _id: conditions }; if (conditions.hasOwnProperty('_id')) - conditions['_id'] = this.options.identifier.reverse(conditions['_id']); + conditions._id = this.options.identifier.reverse(conditions._id); var cursor = this.collection.find(conditions, { fields: fields @@ -338,7 +338,7 @@ export default class Model implement return Bluebird.resolve().bind(this).then(() => { if (conditions.hasOwnProperty('_id')) - conditions['_id'] = this.options.identifier.reverse(conditions['_id']); + conditions._id = this.options.identifier.reverse(conditions._id); return this._cache.get(conditions); }).then((cachedDocument: TDocument) => { @@ -434,7 +434,6 @@ export default class Model implement callback = args[1]; } - var returnArray: boolean = false; if (Array.isArray(objs)) objects = objs; else @@ -511,7 +510,7 @@ export default class Model implement return Bluebird.resolve().then(() => { if (conditions.hasOwnProperty('_id')) - conditions['_id'] = this.options.identifier.reverse(conditions['_id']); + conditions._id = this.options.identifier.reverse(conditions._id); return new Bluebird((resolve, reject) => { this.collection.updateMany(conditions, changes, options,(err, response) => { @@ -554,7 +553,7 @@ export default class Model implement return Bluebird.resolve().then(() => { if (conditions.hasOwnProperty('_id')) - conditions['_id'] = this.options.identifier.reverse(conditions['_id']); + conditions._id = this.options.identifier.reverse(conditions._id); return new Bluebird((resolve, reject) => { this.collection.count(conditions,(err, results) => { @@ -611,7 +610,7 @@ export default class Model implement return Bluebird.resolve().then(() => { if (conditions.hasOwnProperty('_id')) - conditions['_id'] = this.options.identifier.reverse(conditions['_id']); + conditions._id = this.options.identifier.reverse(conditions._id); return new Bluebird((resolve, reject) => { this.collection.remove(conditions, options,(err, response) => {