Skip to content
Browse files

fixed nodelint error on examples

  • Loading branch information...
1 parent f8bfdf4 commit c57e33e010e5bf66acae5f24614a101ff39331cc @kadirpekel committed Oct 22, 2010
View
6 examples/advanced/app.js
@@ -9,15 +9,15 @@ var meryl = require('./../../index');
require('http').createServer(
meryl
- .plug(function(req, resp, next) {
+ .plug(function (req, resp, next) {
resp.filteredSend = function (buffer) {
- resp.send("<h1>" + buffer.toString() + "</h1>")
+ resp.send("<h1>" + buffer.toString() + "</h1>");
};
next();
})
.plug(function (req, resp, next) {
- resp.headers['Server'] = 'node';
+ resp.headers.server = 'node';
console.log(req.method + ' ' + req.params.pathname);
next();
})
View
27 examples/blog-mvc/app.js
@@ -2,38 +2,43 @@ var
fs = require('fs'),
path = require('path'),
connect = require('connect'),
- datastore = require('./datastore');
+ datastore = require('./datastore'),
meryl = require('../../index');
-var controllerDir = 'controllers';
-var viewDir = 'views';
-var staticDir = 'public';
+var controllerDir = 'controllers',
+ viewDir = 'views',
+ staticDir = 'public';
-datastore.load(function() {
+datastore.load(function () {
// Register plugins
- meryl.plug(connect.staticProvider({root: staticDir}), connect.logger())
+ meryl.plug(connect.staticProvider({root: staticDir}), connect.logger());
// Loads controllers automatically
var loadControllers = function (controllerDir, onLoad) {
fs.readdir(controllerDir, function (err, filenames) {
- if (err) throw err;
+ if (err) {
+ throw err;
+ }
var filesRead = 0;
filenames.forEach(function (filename) {
fs.readFile(path.join(controllerDir, filename), function (err, data) {
- if (err) throw err;
+ if (err) {
+ throw err;
+ }
eval(data.toString());
console.log("'" + filename + "' controller loaded.");
- if (filenames.length === ++filesRead) {
+ filesRead += 1;
+ if (filenames.length === filesRead) {
onLoad();
}
});
});
});
- }
+ };
// Run Meryl once controllers loaded
- loadControllers(controllerDir, function() {
+ loadControllers(controllerDir, function () {
meryl.run({templateDir: viewDir});
console.log('listening...');
});
View
6 examples/coffeescript-cgi/boot.js
@@ -2,10 +2,10 @@
* Boot file
*/
-module.exports = function(meryl) {
+module.exports = function (meryl) {
meryl.options = {
templateExt: '.coffee',
templateFunc: require('coffeekup').adapters.meryl
- }
-}
+ };
+};
View
9 examples/connect/app.js
@@ -3,7 +3,7 @@ var Connect = require('connect'),
meryl
.p(
- function(req, resp, next) {
+ function (req, resp, next) {
resp.headers.server = 'nodejs/connect/meryl';
next();
},
@@ -13,11 +13,8 @@ meryl
Connect.favicon(),
Connect.staticProvider()
)
- .h('GET /', function(req, resp) {
- resp.send(
- "<h1>Welcome To NodeJS!</h1>\
- <img src='nodejs.png' />"
- );
+ .h('GET /', function (req, resp) {
+ resp.send("<h1>Welcome To NodeJS!</h1><img src='nodejs.png' />");
})
.run();
View
2 examples/eco-template/app.js
@@ -8,7 +8,7 @@ var opts = {
};
meryl
- .h('GET /', function(req, resp) {
+ .h('GET /', function (req, resp) {
resp.render('layout',
{content: 'home', context: {people: ['bob', 'alice', 'jane', 'meryl']}});
}
View
8 examples/fabby/app.js
@@ -1,17 +1,17 @@
-with(require('connect')) {
+with (require('connect')) {
require('../../index') // meryl
.fabby
(logger(), staticProvider())
- ('GET /', function(req, resp) {
+ ('GET /', function (req, resp) {
resp.render('home');
}
)
- ('GET /posts/{postid}', function(req, resp) {
+ ('GET /posts/{postid}', function (req, resp) {
resp.render('home');
}
)
- ('GET /posts/{postid}/comments/{commentid}', function(req, resp) {
+ ('GET /posts/{postid}/comments/{commentid}', function (req, resp) {
resp.render('home');
}
)
View
4 examples/helloworld/app.js
@@ -1,7 +1,9 @@
var meryl = require('../../index');
meryl
- .h('GET /', function (req, resp) { resp.send("<h1>Hello World!</h1>"); })
+ .h('GET /', function (req, resp) {
+ resp.send("<h1>Hello World!</h1>");
+ })
.run();
console.log('listening...');
View
2 examples/jade-template/app.js
@@ -10,7 +10,7 @@ var opts = {
};
meryl
- .h('GET /', function(req, resp) {
+ .h('GET /', function (req, resp) {
resp.render('layout',
{content: 'home', context: {people: ['bob', 'alice', 'jane', 'meryl']}});
}
View
2 examples/micro-template/app.js
@@ -1,7 +1,7 @@
var meryl = require('../../index');
meryl
- .h('GET /', function(req, resp) {
+ .h('GET /', function (req, resp) {
resp.render('layout', {content: 'home', context: {foo: 'bar'}});
}
)
View
12 examples/paperboy/app.js
@@ -5,19 +5,17 @@ meryl
require('paperboy')
.deliver(__dirname, req, resp)
.addHeader('Expires', 300)
- .error(function(statCode, msg) {
+ .error(function (statCode, msg) {
next();
})
- .otherwise(function(err) {
+ .otherwise(function (err) {
next();
});
})
- .h('GET /', function(req, resp) {
- resp.send(
- "<h1>Welcome To NodeJS!</h1>\
- <img src='nodejs.png' />"
- );
+ .h('GET /', function (req, resp) {
+ resp.send("<h1>Welcome To NodeJS!</h1><img src='nodejs.png' />");
})
.run();
console.log('listening...');
+
View
7 examples/standalone/boot.js
@@ -3,13 +3,12 @@ var connect = require('connect');
// Boot file
// export a function accepting Meryl instance
-module.exports = function(meryl) {
+module.exports = function (meryl) {
meryl.plug(connect.staticProvider(), connect.logger());
meryl.options = {
templateExt: '.mt', // Default is '.jshtml'
port: 3000 // Already the default one
- }
-
-}
+ };
+};
View
8 examples/twinkler/app.js
@@ -6,19 +6,19 @@ var twinkles = ['This is my freaking first wink', 'Hey tweeting sucks, lets twi
meryl.p(Connect.staticProvider({root: 'public'}));
-meryl.h('GET /', function(req, resp) {
+meryl.h('GET /', function (req, resp) {
resp.render('index', {twinkles: twinkles});
});
-meryl.h('POST /newwink', function(req, resp) {
+meryl.h('POST /newwink', function (req, resp) {
var postdataAsObject = qs.parse(req.postdata.toString());
- if(postdataAsObject && postdataAsObject.wink) {
+ if (postdataAsObject && postdataAsObject.wink) {
twinkles.push(postdataAsObject.wink);
}
resp.redirect('/');
});
-meryl.run({templateDir:'views'});
+meryl.run({templateDir: 'views'});
console.log('listening...');
View
2 jslint
@@ -1 +1 @@
-nodelint --config nodelint.cfg index.js lib/*.js test/*js examples/*.js
+nodelint --config nodelint.cfg index.js lib/*.js test/*js $@
View
3 lib/meryl.js
@@ -210,7 +210,8 @@ Meryl.prototype = {
plug: function () {
var args = Array.prototype.slice.call(arguments),
first = args.shift(),
- pattern = '*', callback = first;
+ pattern = '*',
+ callback = first;
if (typeof first === 'string') {
pattern = first;
callback = args.shift();

0 comments on commit c57e33e

Please sign in to comment.
Something went wrong with that request. Please try again.