couchdb-view-cache-stream
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -7,2 +7,3 @@ var url = require('url') | ||
var from = require('from2') | ||
var clone = require('lodash.clonedeep') | ||
@@ -18,4 +19,9 @@ module.exports = function (view_url, opts) { | ||
if (err) return ready(err) | ||
if (last_etag === resp.headers.etag) return ready(null, from.obj(current_view)) | ||
if (last_etag === resp.headers.etag) { | ||
// clone on the way out | ||
var dapipe = from.obj(current_view).pipe(through.obj(function (data, enc, cb) { | ||
cb(null, clone(data)) | ||
})) | ||
return ready(null, dapipe) | ||
} | ||
var tempdb = [] | ||
@@ -26,3 +32,3 @@ var dapipe = request(view_url).pipe(jsonfilter('rows.*')) | ||
tempdb.push(data.value) | ||
cb(null, data.value) | ||
cb(null, clone(data.value)) | ||
}, function (cb) { | ||
@@ -29,0 +35,0 @@ last_etag = resp.headers.etag |
{ | ||
"name": "couchdb-view-cache-stream", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "An experimental way to cache the results of a couchdb view", | ||
@@ -9,2 +9,3 @@ "main": "lib/index.js", | ||
"jsonfilter": "^1.1.2", | ||
"lodash.clonedeep": "^3.0.2", | ||
"ndjson": "^1.4.1", | ||
@@ -11,0 +12,0 @@ "request": "^2.58.0", |
3888
88
6
+ Addedlodash.clonedeep@^3.0.2
+ Addedlodash._arraycopy@3.0.0(transitive)
+ Addedlodash._arrayeach@3.0.0(transitive)
+ Addedlodash._baseassign@3.2.0(transitive)
+ Addedlodash._baseclone@3.3.0(transitive)
+ Addedlodash._basecopy@3.0.1(transitive)
+ Addedlodash._basefor@3.0.3(transitive)
+ Addedlodash._bindcallback@3.0.1(transitive)
+ Addedlodash._getnative@3.9.1(transitive)
+ Addedlodash.clonedeep@3.0.2(transitive)
+ Addedlodash.isarguments@3.1.0(transitive)
+ Addedlodash.isarray@3.0.4(transitive)
+ Addedlodash.keys@3.1.2(transitive)