Add support for modules that redefine module.exports #8

Open
wants to merge 3 commits into
from

Projects

None yet

1 participant

Add support for modules that redefine module.exports which is common with node libraries.
For example, if the module does:

module.exports = function () {...}

Then the client code can do:

require('foo')(args)

For example, here's a UUID library that uses this idiom: https://github.com/broofa/node-uuid

I believe pull request 6 is trying to achieve the same effect, but it breaks compatibility with CommonJS Modules/1.1 as the module object doesn't have the url or id properties.

This patch maintains compatibility with Modules/1.1, although it still breaks the requirement that "modules must use the "exports" object as the only means of exporting." (emphasis added).

danieldickison and others added some commits Aug 24, 2011
@danieldickison danieldickison Add support for modules that redefine module.exports which is common …
…with node libraries.

For example, if the module does:
    module.exports = function () {...}
Then the client code can do:
    require('foo')(args)
612fcd5
@danieldickison danieldickison Bump version to 0.3.1 to distinguish from the npm-published version. 5dfe092
John Conomikes Fixed eval depreciation 12791ef
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment