Browse Source

Fix code style to match standard version 5 code style

saintedlama/travis-non-legacy
saintedlama 9 years ago
parent
commit
54a9ab9844
  1. 3
      lib/collection.js
  2. 2
      lib/cursor.js
  3. 1
      test/insert.js
  4. 4
      test/test-aggregate-pipeline.js
  5. 4
      test/test-aggregate.js
  6. 3
      test/test-pass-mongojs.js

3
lib/collection.js

@ -13,6 +13,7 @@ var indexName = function (index) {
return key + '_' + index[key]
}).join('_')
}
// TODO: Use driver functionality where possible and don't hit command interface
var Collection = function (opts, getConnection) {
this._name = opts.name
@ -128,7 +129,7 @@ Collection.prototype.save = function (doc, cb) {
Collection.prototype.remove = function (query, options, cb) {
if (typeof query === 'function') return this.remove({}, {justOne: false}, query)
if (typeof options === 'function') return this.remove(query, {justOne: false}, options)
if (typeof options === 'boolean') return this.remove(query, { justOne: options}, cb)
if (typeof options === 'boolean') return this.remove(query, {justOne: options}, cb)
this._getCollection(function (err, collection) {
if (err) return cb(err)

2
lib/cursor.js

@ -15,7 +15,7 @@ var Cursor = function (getCursor) {
// Apply all opts
for (var key in self._opts) {
if (self._opts.hasOwnProperty(key)) {
cursor = cursor[key].call(cursor, self._opts[key])
cursor = cursor[key](self._opts[key])
}
}

1
test/insert.js

@ -16,7 +16,6 @@ module.exports = function (testName, docs, testFn) {
})
})
})
})
})
}

4
test/test-aggregate-pipeline.js

@ -12,7 +12,7 @@ insert('aggregate', [{
}], function (db, t, done) {
db.a.aggregate([{$group: {_id: '$type'}}, {$project: { _id: 0, foo: '$_id' }}], function (err, types) {
console.log(err, types)
var arr = types.map(function (x) {return x.foo})
var arr = types.map(function (x) { return x.foo })
console.log('arr', arr)
t.equal(types.length, 2)
console.log('here')
@ -24,7 +24,7 @@ insert('aggregate', [{
// test as a stream
var strm = db.a.aggregate([{$group: {_id: '$type'}}, {$project: {_id: 0, foo: '$_id'}}])
strm.pipe(concat(function (types) {
var arr = types.map(function (x) {return x.foo})
var arr = types.map(function (x) { return x.foo })
t.equal(types.length, 2)
t.notEqual(arr.indexOf('fire'), -1)
t.notEqual(arr.indexOf('water'), -1)

4
test/test-aggregate.js

@ -12,7 +12,7 @@ insert('aggregate', [{
}], function (db, t, done) {
db.a.aggregate({$group: {_id: '$type'}}, function (err, types) {
console.log(err, types)
var arr = types.map(function (x) {return x._id})
var arr = types.map(function (x) { return x._id })
t.equal(types.length, 2)
t.notEqual(arr.indexOf('fire'), -1)
t.notEqual(arr.indexOf('water'), -1)
@ -20,7 +20,7 @@ insert('aggregate', [{
// test as a stream
var strm = db.a.aggregate({$group: {_id: '$type'}})
strm.pipe(concat(function (types) {
var arr = types.map(function (x) {return x._id})
var arr = types.map(function (x) { return x._id })
t.equal(types.length, 2)
t.notEqual(arr.indexOf('fire'), -1)
t.notEqual(arr.indexOf('water'), -1)

3
test/test-pass-mongojs.js

@ -2,7 +2,6 @@ var test = require('./tape')
var mongojs = require('../')
test('receive a mongojs instance', function (t) {
var db = mongojs(mongojs('test', []), ['a'])
var afterFind = function () {
db.a.remove(function (err) {
@ -30,6 +29,6 @@ test('receive a mongojs instance', function (t) {
t.error(err)
db.a.insert({name: 'Pidgey'}, afterInsert)
}
db.a.remove(afterRemove)
db.a.remove(afterRemove)
})

Loading…
Cancel
Save