freewil / express-form

Form validation and data filtering for Express
MIT License
89 stars 21 forks source link

Export Field object #17

Closed chazzu closed 10 years ago

chazzu commented 10 years ago

If you add form.Field = Field into form.js, others could modify the Field prototype for 'cleaner' custom validators and filters. Is there any particular reason you chose not to do this? Legitimately curious if there is a reason this might be a bad practice.

freewil commented 10 years ago

Generally, I would say that modifying modules like this is a bad idea - although certainly not as bad as adding a custom method to a global object like Array.

Why could you not create your own little wrapper module that uses custom? Could you maybe show some example code that compares the two approaches?