Exports is a helper that actually points to Module.exports. Exports is the recommended way to go, unless you need to chance the Object type of Module.exports. So generally:
Bad: Module.exports = {} Good: Exports.name = function(){}
<?xml version="1.0" encoding="UTF-8"?> | |
<opml version="1.0"> | |
<head> | |
<title>Jacques subscriptions in Google Reader</title> | |
</head> | |
<body> | |
<outline title="Football" text="Football"> | |
<outline text="11 tegen 11" title="11 tegen 11" type="rss" | |
xmlUrl="http://11tegen11.wordpress.com/feed/" htmlUrl="http://11tegen11.wordpress.com"/> | |
<outline text="A Beautiful Numbers Game" |
var fs = require('fs') | |
// So, callbacks. When readFile is complete, the callback is 'called' | |
// And we get our console.log without blocking whatever might be next. | |
var file = fs.readFile('./example', 'utf-8', function(err, contents){ | |
if (err) | |
console.log('You iz dumb'); | |
else | |
console.log(file); | |
}); |
Productive capactity
Migrations
// Javascript constructors! | |
// A constructor is just a plain old function that's invoked with the `new` | |
// operator, and which produces a specialized object. Useful when you have | |
// many similar objects. | |
// Here, `Person` is a constructor. | |
function Person(name, nickname, age) { | |
this.name = name; | |
this.nickname = nickname; | |
this.age = age; |
long | lat | |
---|---|---|
594162 | 4932451 |
I was looking for a way to simplify the following process:
It's a very common pattern, and I don't like retyping it. These are the 'solutions' to that problem.