1.0.0 • Published 10 years ago
thus v1.0.0
thus
Create a JavaScript scope in which the enclosing function's first argument is referred to as `this'.
This is primarily a convenience function for writing CoffeeScript:
thus express(), ->
@set 'view engine', 'jade'
@listen 8080
Expressed in JS, that would be:
thus(express(), function() {
this.set('view engine', 'jade');
this.listen(8080);
});
Which is functionally equivalent to:
var app = express();
app.set('view engine', 'jade');
app.listen(8080);
Might seem stupid, but I like writing code this way.
1.0.0
10 years ago