Browse Source

Adjust code style in argument sanitizing

saintedlama/tap-spec
saintedlama 9 years ago
parent
commit
9340152196
  1. 8
      lib/collection.js

8
lib/collection.js

@ -199,8 +199,8 @@ Collection.prototype.dropIndex = function (index, cb) {
Collection.prototype.createIndex = function (index, opts, cb) {
if (typeof opts === 'function') return this.createIndex(index, {}, opts)
if (typeof opts === 'undefined') return this.createIndex(index, {}, noop)
if (typeof cb === 'undefined') return this.createIndex(index, opts, noop)
if (!opts) return this.createIndex(index, {}, noop)
if (!cb) return this.createIndex(index, opts, noop)
this._getCollection(function (err, collection) {
if (err) return cb(err)
@ -211,8 +211,8 @@ Collection.prototype.createIndex = function (index, opts, cb) {
Collection.prototype.ensureIndex = function (index, opts, cb) {
if (typeof opts === 'function') return this.ensureIndex(index, {}, opts)
if (typeof opts === 'undefined') return this.ensureIndex(index, {}, noop)
if (typeof cb === 'undefined') return this.ensureIndex(index, opts, noop)
if (!opts) return this.ensureIndex(index, {}, noop)
if (!cb) return this.ensureIndex(index, opts, noop)
this._getCollection(function (err, collection) {
if (err) return cb(err)

Loading…
Cancel
Save