CoffeeScript and NodeJS: How do I export multiple classes?
coffeescript, commonjs, node.js
Solution
You could use something like this:
class exports.Dog
bark: -> console.log "Arff! :D"
This compiles down to:
exports.Dog = (function() {
function Dog() {}
Dog.prototype.bark = function() {
return console.log("Arff! :D");
};
return Dog;
})();
Problem
I want to export some classes, say, `Dog` and `Cat`. One way to go about this is: ``` class Dog bark: -> console.log "Arff! :D" class Cat meaow: -> console.log "Meaw!" module.exports = {Dog, Cat} ``` How can I do something similar without typing the class names twice?