New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

backbone-pouch-collection

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

backbone-pouch-collection - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

16

index.js

@@ -17,6 +17,11 @@ 'use strict';

if (method === 'read') {
var opts = typeof this.opts == 'function' ? this.opts() : this.opts
_.defaults(options.couch || (options.couch = {}), opts.params)
var opts = this.opts || {}
opts = typeof opts == 'function' ? opts() : opts
_.defaults(options.couch || (options.couch = {}), opts.params, {
include_docs: true
})
if (opts.view === '_all_docs') {
// default to '_all_docs' if view isn't specified
if (opts.view === '_all_docs' || !opts.view) {
promise = this.db.allDocs(options.couch, cb)

@@ -39,7 +44,8 @@ } else {

if (options.couch && options.couch.include_docs)
if (options.couch && options.couch.include_docs) {
return res.rows.map(function (row) { return row.doc })
else
} else {
return res
}
}
})
{
"name": "backbone-pouch-collection",
"version": "0.2.0",
"version": "0.3.0",
"description": "Backbone Collections with PouchDB as the data source",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -18,2 +18,6 @@ backbone-pouch-collection

`opts.view` can also be `_all_docs` to query...well... `_all_docs`.
The defaults are `_all_docs` and `include_docs: true`.
```javascript

@@ -35,4 +39,2 @@ var PouchBase = require('backbone-pouch-collection')

`opts.view` can also be `_all_docs` to query...well... `_all_docs`.
You can also pass options to `collection.fetch()` to override the

@@ -39,0 +41,0 @@ default.

@@ -186,3 +186,47 @@ var assert = require('assert')

})
it('should have defaults', function (done) {
var child = new PouchBase()
child.db = this.db
var promise = child.fetch({
success: function (collection, res, opts) {
assert(opts)
assert(opts.couch, 'should have couch options')
assert.equal(collection.length, 5)
assert.equal(res.rows.length, 5)
assert(opts.couch.include_docs, 'include_docs should be default')
done()
},
error: function (err) { done(err) }
})
assert(promise)
})
it('include_docs', function (done) {
var child = new PouchBase()
child.db = this.db
child.opts = {
params: {
startkey: '_design/',
endkey: '_design/\ufff0'
}
}
var promise = child.fetch({
success: function (collection, res, opts) {
assert(opts)
assert(opts.couch, 'should have couch options')
assert.equal(collection.length, 1)
assert.equal(res.rows.length, 1)
assert(opts.couch.include_docs, 'include_docs should be default')
done()
},
error: function (err) { done(err) }
})
assert(promise)
})
})
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc