Comparing version 0.5.8 to 0.6.0
40
nano.js
@@ -17,8 +17,9 @@ /* minimal couch in node | ||
*/ | ||
var request = require('request') | ||
, fs = require('fs') | ||
, qs = require('querystring') | ||
, _ = require('underscore') | ||
, error = require('./error') | ||
, headers = { "content-type": "application/json" } | ||
var request = require('request') | ||
, fs = require('fs') | ||
, qs = require('querystring') | ||
, _ = require('underscore') | ||
, error = require('./error') | ||
, headers = { "content-type": "application/json" } | ||
, default_url = "http://localhost:5984" | ||
, nano; | ||
@@ -38,8 +39,7 @@ | ||
if(typeof cfg === "string") { | ||
try { | ||
cfg = require(cfg); // no cfg? maybe it's a file path? | ||
if(/^https?:/.test(cfg)) { cfg = {url: cfg}; } // url | ||
else { | ||
try { cfg = require(cfg); } // file path | ||
catch(e) { console.error("bad cfg: couldn't load file"); } | ||
} | ||
catch(e) { | ||
cfg = {url: cfg}; // not a file path? guess it's the url | ||
} | ||
} | ||
@@ -49,2 +49,6 @@ if(cfg.proxy) { | ||
} | ||
if(!cfg.url) { | ||
console.error("bad cfg: using default=" + default_url); | ||
cfg = {url: default_url}; // if everything else fails, use default | ||
} | ||
@@ -245,14 +249,2 @@ /**************************************************************************** | ||
} | ||
/* | ||
* returns couchdb + nano configuration | ||
* | ||
* @see relax | ||
*/ | ||
function config(callback) { | ||
return relax({db: "_config", method: "GET"}, function (e,h,r) { | ||
if(e) { callback(e); } | ||
callback(null,h,{nano: cfg, couch: r}); | ||
}); | ||
} | ||
@@ -458,3 +450,3 @@ /**************************************************************************** | ||
, request: relax | ||
, config: config | ||
, config: cfg | ||
, relax: relax // alias | ||
@@ -461,0 +453,0 @@ , dinosaur: relax // alias |
{ "name": "nano" | ||
, "description": "minimalistic couchdb driver for node.js" | ||
, "homepage": "http://github.com/dscape/nano" | ||
, "version": "0.5.8" | ||
, "version": "0.6.0" | ||
, "author": "Nuno Job <nunojobpinto@gmail.com> (http://nunojob.com)" | ||
@@ -6,0 +6,0 @@ , "keywords": ["couchdb", "data", "request", "json", "nosql", "micro", "nano"] |
@@ -77,3 +77,3 @@ # nano | ||
`nano.request(opts,callback*)` | ||
`nano.config(callback)` | ||
`nano.config` | ||
@@ -80,0 +80,0 @@ ### aliases |
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
55521
33
1356