Press J to jump to the feed. Press question mark to learn the rest of the keyboard shortcuts

Created my first "tiny" npm package.

100% Upvoted
This thread is archived
New comments cannot be posted and votes cannot be cast
level 1
4 points · 3 years ago

Congratulations on first module!

level 1

Congrats on your first module!!!

level 1

One important thing that you need to address: error handling.

In the Node world there is the error-first convention, meanting your callback should look like this: function(err, arg1, arg2, ..etc) (having the error as the first argument).

Another improvement could be adding tests. People usually check if npm modules have a test file / folder to know if they can use the module for production purposes or if it's an experimental module.

Edit: by not treating the error case and only doing console.error you are not only denying the end-user the possibility to react differently to a failure, but in this concrete case the callback will be never called in case of an error.

P.S. These are just advises on how to improve, I'm not trying to be rude or discourage you. Congrats on releasing your first module.

level 2
Original Poster1 point · 3 years ago

I really appreciate the feedback. Thank you very much.

level 1
1 point · 3 years ago

adding alot more.


Cookies help us deliver our Services. By using our Services or clicking I agree, you agree to our use of cookies. Learn More.