Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support with node.js modules? #20

Closed
adibiton opened this issue Aug 8, 2018 · 2 comments
Closed

Adding support with node.js modules? #20

adibiton opened this issue Aug 8, 2018 · 2 comments

Comments

@adibiton
Copy link

adibiton commented Aug 8, 2018

Hi,
Sorry if it not the right place, but can the library be supported with common js module system (adding
'module.exports = Enum' at the end of the script)?

Thanks

@coagmano
Copy link

@adibiton If you look at the built code published on npm, you'll see that Enum is placed on the exports object for CJS compatability:

var Enum = exports.Enum = function () {

Which means you can require no problem. Easier with destructing:

var { Enum } = require('enumify');

@adibiton
Copy link
Author

@coagmano got it, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants