Jakobo/inject — Issue #19: module.setExports support
Author: Jakobo
Created: 2011-11-15 22:02:55+00:00
State: open
Labels: CommonJS Compliance

http://wiki.commonjs.org/wiki/Modules/SetExports

Introduce a function on modue called .setExports(obj)

* if modules.exports contains any members, this should throw an error
* if module.exports is not defined, obj should be assigned to module.exports and returned

Common case implementation

```
require("awesomeModule");
// ... code.....
return module.setExports(myObj);
```

This is a lot cleaner than `module.exports = myObj`, though backwards compatibility should be maintained.