Comparing version 0.0.11 to 0.0.12
@@ -6,3 +6,3 @@ { | ||
"author": "Dale Harvey", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"main": "./src/pouch.js", | ||
@@ -26,5 +26,5 @@ "homepage": "https://github.com/daleharvey/pouchdb", | ||
"jam": { | ||
"main": "dist/pouch.amd-nightly.js", | ||
"main": "dist/pouchdb.amd-nightly.js", | ||
"include": [ | ||
"dist/pouch.amd-nightly.js", | ||
"dist/pouchdb.amd-nightly.js", | ||
"README.md", | ||
@@ -31,0 +31,0 @@ "LICENSE" |
@@ -727,15 +727,15 @@ /*globals Pouch: true, call: false, ajax: true */ | ||
// For each change | ||
res.results.forEach(function(c) { | ||
var hasFilter = opts.filter && typeof opts.filter === 'function'; | ||
var req = {}; | ||
req.query = opts.query_params; | ||
var hasFilter = opts.filter && typeof opts.filter === 'function'; | ||
var req = {}; | ||
req.query = opts.query_params; | ||
res.results = res.results.filter(function(c) { | ||
if (opts.aborted || hasFilter && !opts.filter.apply(this, [c.doc, req])) { | ||
return; | ||
return false; | ||
} | ||
if (opts.doc_ids && opts.doc_ids.indexOf(c.id) !== -1) { | ||
return; | ||
return false; | ||
} | ||
// Process the change | ||
call(opts.onChange, c); | ||
return true; | ||
}); | ||
@@ -742,0 +742,0 @@ } |
@@ -828,3 +828,3 @@ /*globals call: false, extend: false, parseDoc: false, Crypto: false */ | ||
function onTxnComplete() { | ||
dedupResults.map(filterChange(opts)); | ||
dedupResults = dedupResults.filter(filterChange(opts)); | ||
call(opts.complete, null, {results: dedupResults}); | ||
@@ -831,0 +831,0 @@ } |
@@ -663,3 +663,3 @@ /*globals extend: true, isDeleted: true, isLocalId: true */ | ||
// filters changes in-place, calling opts.onChange on matching changes | ||
results.map(Pouch.utils.filterChange(opts)); | ||
results = results.filter(Pouch.utils.filterChange(opts)); | ||
call(opts.complete, null, {results: results}); | ||
@@ -852,2 +852,4 @@ }); | ||
LevelPouch.use_prefix = false; | ||
Pouch.adapter('ldb', LevelPouch); | ||
@@ -854,0 +856,0 @@ Pouch.adapter('leveldb', LevelPouch); |
@@ -624,4 +624,3 @@ /*globals call: false, extend: false, parseDoc: false, Crypto: false */ | ||
} | ||
dedupResults.map(filterChange(opts)); | ||
dedupResults = dedupResults.filter(filterChange(opts)); | ||
call(opts.complete, null, {results: dedupResults}); | ||
@@ -628,0 +627,0 @@ }); |
@@ -88,6 +88,7 @@ /*globals PouchAdapter: true, extend: true */ | ||
var match = name.match(/([a-z\-]*):\/\/(.*)/); | ||
var adapter; | ||
if (match) { | ||
// the http adapter expects the fully qualified name | ||
name = /http(s?)/.test(match[1]) ? match[1] + '://' + match[2] : match[2]; | ||
var adapter = match[1]; | ||
adapter = match[1]; | ||
if (!Pouch.adapters[adapter].valid()) { | ||
@@ -102,4 +103,7 @@ throw 'Invalid adapter'; | ||
if (preferredAdapters[i] in Pouch.adapters) { | ||
adapter = Pouch.adapters[preferredAdapters[i]]; | ||
var use_prefix = 'use_prefix' in adapter ? adapter.use_prefix : true; | ||
return { | ||
name: Pouch.prefix + name, | ||
name: use_prefix ? Pouch.prefix + name : name, | ||
adapter: preferredAdapters[i] | ||
@@ -106,0 +110,0 @@ }; |
@@ -219,6 +219,6 @@ /*jshint strict: false */ | ||
if (opts.filter && !opts.filter.call(this, change.doc, req)) { | ||
return; | ||
return false; | ||
} | ||
if (opts.doc_ids && opts.doc_ids.indexOf(change.id) !== -1) { | ||
return; | ||
return false; | ||
} | ||
@@ -229,2 +229,3 @@ if (!opts.include_docs) { | ||
call(opts.onChange, change); | ||
return true; | ||
}; | ||
@@ -231,0 +232,0 @@ }; |
661673
12006