Google Groups

Question: Misuse of variables bound to exports object?


akira Apr 27, 2012 9:54 PM
Posted in group: nodejs
I am sorry if this is not node related, I just thought this might be a
good place to ask since a lot of module developers are on this list.

Using this simple example, I would like to inherit a form

exports.EmailForm = forms.Form.extend({
    email_address  : forms.EmailField({required: true})
})

exports.ExtendedEmailForm = exports.EmailForm.extend({ // <- Extending
EmailForm
    subject    : forms.CharField({maxLength: 100})
    , message  : forms.CharField()
    , sender   : forms.EmailField({required: true})
})


Is this a misuse? It works, but normally one would do something like
this:

var EmailForm = forms.Form.extend({
    email_address  : forms.EmailField({required: true})
})


But I would like to export the simple EmailForm class for usage in
other modules too. Thanks