Am Sonntag, den 04.03.2012, 06:13 -0300 schrieb Tito Ciuro:
> He replied with: "@titusmagnus module.exports = function default () {}.
> module.exports.notdefault = function () {}"
>
> I'm fairly new to Node and I don't really know how to implement a module with
> this syntax. As a matter of fact, I haven't been able to find any related
> documentation. What is the purpose of default() and notdefault()? Is there a
> page where I can see this in action? A real example would be awesome.
a.js
===================
module.exports = function foo() {
console.log("foo!")
}
module.exports.bar = function bar() {
console.log("qux!")
}
b.js
===================
var a = require('./a.js')
a() // prints "foo!"
a.bar() // prints "qux!"
signature.asc
Description: This is a digitally signed message part
