Comparing version 1.3.37 to 2.0.0
32
nano.js
@@ -152,3 +152,9 @@ /* minimal couch in node | ||
try { | ||
req.body = JSON.stringify(opts.body); | ||
req.body = JSON.stringify(opts.body, function (key, value) { | ||
if (typeof(value) === 'function') { | ||
return value.toString(); | ||
} else { | ||
return value; | ||
} | ||
}); | ||
} catch (ex5) { | ||
@@ -309,14 +315,14 @@ ex5.message = "couldn't json.stringify the body you provided"; | ||
* @param {target:string} name of the target database | ||
* @param {continuous:bool:optional} continuous replication on? | ||
* @param {opts:object:optional} options to the replicator | ||
* | ||
* @see relax | ||
*/ | ||
function replicate_db(source, target, continuous, callback) { | ||
if(typeof continuous === "function") { | ||
callback = continuous; | ||
continuous = false; | ||
function replicate_db(source, target, opts, callback) { | ||
if(typeof opts === "function") { | ||
callback = opts; | ||
opts = {}; | ||
} | ||
var body = {source: source, target: target}; | ||
if(continuous) { body.continuous = true; } | ||
return relax({db: "_replicate", body: body, method: "POST"},callback); | ||
opts.source = source; | ||
opts.target = target; | ||
return relax({db: "_replicate", body: opts, method: "POST"}, callback); | ||
} | ||
@@ -560,8 +566,4 @@ | ||
public_functions = { info: function(cb) { return get_db(db_name,cb); } | ||
, replicate: function(target,continuous,cb) { | ||
if(typeof continuous === "function") { | ||
cb = continuous; | ||
continuous = false; | ||
} | ||
return replicate_db(db_name,target,continuous,cb); | ||
, replicate: function(target,opts,cb) { | ||
return replicate_db(db_name,target,opts,cb); | ||
} | ||
@@ -568,0 +570,0 @@ , compact: function(cb) { |
@@ -5,3 +5,3 @@ { "name" : "nano" | ||
, "repository" : "git://github.com/dscape/nano" | ||
, "version" : "1.3.37" | ||
, "version" : "2.0.0" | ||
, "author" : "Nuno Job <nunojobpinto@gmail.com> (http://nunojob.com)" | ||
@@ -19,2 +19,3 @@ , "contributors" : | ||
, "Stéphane Alnet <stephane@shimaore.net> (http://blog.shimaore.net)" | ||
, "Cliffano Subagio (http://blog.cliffano.com)" | ||
] | ||
@@ -21,0 +22,0 @@ , "keywords" : |
@@ -88,3 +88,3 @@ # nano | ||
`server.db.compact(db_name,design_name*,callback*)` | ||
`server.db.replicate(source,target,continuous*,callback*)` | ||
`server.db.replicate(source,target,opts*,callback*)` | ||
`server.db.changes(db_name,params*,callback*)` | ||
@@ -121,3 +121,3 @@ `server.use(db_name)` | ||
`server.db.get: [db.info(callback*)]` | ||
`server.db.replicate: [db.replicate(target,continuous*,callback*)]` | ||
`server.db.replicate: [db.replicate(target,opts*,callback*)]` | ||
`server.db.compact: [db.compact(callback*), db.view.compact(design_name,callback*)]` | ||
@@ -124,0 +124,0 @@ `server.db.changes: [db.changes(params*,callback*)]` |
@@ -67,5 +67,6 @@ var ensure = require('ensure') | ||
this.t.equal(from_buffer, pixel, 'Buffer is pixel'); | ||
this.t.equal(b.toString("base64"), pixel, 'Result buffer is pixel'); | ||
this.t.ok(couch.isDone(), 'Nock is done'); | ||
}; | ||
ensure(__filename,tests,module,process.argv[2]); | ||
ensure(__filename,tests,module,process.argv[2]); |
@@ -36,3 +36,3 @@ var ensure = require('ensure') | ||
'cache-control': 'must-revalidate' }) | ||
.put('/' + db_name('b') + '/some%2Fpath', {"foo": "bar"}) | ||
.put('/' + db_name('b') + '/some%2Fpath', {"foo": "bar", "fn": "function () { return true; }", fn2: "function () { return false; }"}) | ||
.reply(201, "{\"ok\": true,\"id\": \"some/path\",\"rev\": \"1-4c6114c65e295552ab1019e2b046b10e\"}\n", | ||
@@ -65,3 +65,5 @@ { server: 'CouchDB/1.1.1 (Erlang OTP/R14B04)', | ||
nano.db.create(db_name("b"), function () { | ||
db("b").insert({foo: "bar"}, 'some/path', callback); | ||
db("b").insert({foo: "bar", fn: function () { return true; }, | ||
fn2: "function () { return false; }" }, | ||
'some/path', callback); | ||
}); | ||
@@ -68,0 +70,0 @@ }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
126928
2832