Skip to content
This repository was archived by the owner on Nov 5, 2018. It is now read-only.

fix whitespace issues & add .editorconfig file #293

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix whitespace issues & add .editorconfig file
  • Loading branch information
notslang committed Oct 9, 2015
commit 42711448407b58398850a9922b93e1617be933ee
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[*]
end_of_line = lf
indent_style = space
indent_size = 2
insert_final_newline = true
max_line_length = 80
trim_trailing_whitespace = true
8 changes: 4 additions & 4 deletions examples/bulk_transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ function update_row(row,cb) {
function list(offset) {
var ended = false;
offset = offset || 0;
db.list({include_docs: true, limit: 10, skip: offset},
db.list({include_docs: true, limit: 10, skip: offset},
function(err, data) {
var total, offset, rows;
if(err) { console.log('fuuuu: ' + err.message); rows = []; return; }
total = data.total_rows;
offset = data.offset;
rows = data.rows;
if(offset === total) {
if(offset === total) {
ended = true;
return;
return;
}
async.forEach(rows, update_row, function (err) {
if(err) { console.log('something failed, check logs'); }
Expand All @@ -45,4 +45,4 @@ function list(offset) {
});
}

list();
list();
14 changes: 7 additions & 7 deletions examples/lazy_creation_of_views.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
module.exports = function() {
var nano = require('nano')('http://localhost:5984')
, users = nano.use('users')
, VIEWS = { by_twitter_id:
, VIEWS = { by_twitter_id:
{ "map": "function(doc) { emit(doc.twitter.screen_name, doc); }" } }
;

Expand Down Expand Up @@ -56,7 +56,7 @@ function user_create(email_address,secret,name,retries) {
/*****************************************************************************
* user.find()
****************************************************************************/
//
//
// some more logic needed
// what if design document exists but view doesnt, we cant just overwrite it
//
Expand All @@ -69,11 +69,11 @@ function user_find(view, id, opts, tried, callback) {
tried = {tried:0, max_retries:2};
}
users.view('users', view, opts, function (e,b,h) {
if(e) {
if(e) {
var current_view = VIEWS[view];
if(!current_view) {
if(!current_view) {
e.message = 'View is not available';
return callback(e,b,h);
return callback(e,b,h);
}
if(tried.tried < tried.max_retries) {
if(e.message === 'missing' || e.message === 'deleted') { // create design document
Expand All @@ -96,7 +96,7 @@ function user_find(view, id, opts, tried, callback) {
return;
}
}
else { return callback(e,b,h); }
else { return callback(e,b,h); }
}
return callback(null,b,h);
});
Expand All @@ -111,4 +111,4 @@ return { new: user_new
, create: user_create
, first: user_first
};
};
};
6 changes: 3 additions & 3 deletions examples/lazy_db_creation_and_replication.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// the License.

var nano = require('nano')
, couch =
, couch =
{ "master" : "http://localhost:5984/landing_m"
, "replica" : "http://localhost:5984/landing_r"
}
Expand All @@ -24,7 +24,7 @@ function insert_with_retry(db, email, retries, callback) {
}
callback = callback || function(){};
db.insert(email, function(err, resp, head) {
if(err) {
if(err) {
if(err.message === 'no_db_file' && retries < 1) {
var db_name = db.config.db
, server = nano(db.config.url)
Expand Down Expand Up @@ -62,4 +62,4 @@ function replicate_with_retry(master_uri, replica_uri, retries, callback) {
});
}

module.exports = {insert: insert_with_retry, replicate: replicate_with_retry};
module.exports = {insert: insert_with_retry, replicate: replicate_with_retry};
2 changes: 1 addition & 1 deletion examples/pipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ app.get("/", function(request,response) {
db.attachment.get("new", "logo.png").pipe(response);
});

app.listen(3333);
app.listen(3333);
4 changes: 2 additions & 2 deletions examples/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

if you have a sample please feel free to send a pull request.

also the tests are very concise and helpful.
also the tests are very concise and helpful.

i would recommend taking a peek.
i would recommend taking a peek.