title: Module export multiple classes
body: <p>This is /cars/ford.js</p>
  
  <pre><code>                   Ford = Car.extend({
                      classId: 'Ford',
  
                      init: function (driver) {
                          this._driver = driver;
                          Car.prototype.init.call(this);
  
  
                      tick: function (ctx) {
                          Car.prototype.tick.call(this, ctx);
                      },
  
                      destroy: function () {
                          if (this._driver !== undefined) {
                              this._driver._license.pull(this);
                          }
                          Car.prototype.destroy.call(this);
                      }
                  });
  
  if (typeof(module) !== 'undefined' &amp;&amp; typeof(module.exports) !== 'undefined') {
                  module.exports = Ford;
              }
  </code></pre>
  
  <p>This is /cars/knightrider.js:</p>
  
  <pre><code>                   KITT = Car.extend({
                      classId: 'KITT',
  
                      init: function () {
                      Car.prototype.init.call(this);
                      var self = this;
                      },
  
  
  newDirection: function () {
      var self = this;
  
      this._move.direction()
          .duration(Math.random())
          .properties({
              x: Math.random(),
              y: Math.random(),
          })
          .voice('robotic')
          .afterDirection(function () {
              self.newDirection();
          })
          .start();
  
  
  }
                  });
  
  if (typeof(module) !== 'undefined' &amp;&amp; typeof(module.exports) !== 'undefined') {
                  module.exports = KITT;
              }
  </code></pre>
  
  <p>I want to have all cars inside the same file to preserve my self sanity. How can I wrap them without altering my classes? Feel free to recommend any 'proper packaging' for Javascript functions book or tutorial, because I really dislike to open files. When I'm editing a car, I might want to edit other one.</p>
  
  <p>Wish I could do:</p>
  
  <pre><code>        module.exports.Allmycars = KITT, Ford;
  </code></pre>
  
  <p>And then call them with:</p>
  
  <pre><code>        Allmycars.Ford
  </code></pre>