Feeback on my npm package

Simple but honest work. lol

AND

Thanks in advance

1 Like

With the funtion package, the names are both very verbose and, for all but the last, not particularly descriptive of what they do: filter is a more descriptive name and is more compact, and much more useful. The last function does exactly the same as map and Array.from: it doesn’t simplify, it just renames.

But I get this is just practice. What I would look at is how you publish stuff in a bit more depth, it’s very useful to know.

In terms of general package structure, I can’t use this package in a browser. A UMD module version would be useful as well as the CommonJS you have there. Preferably you would publish as an ESModule, which is understood by Node, browsers, Deno, etc. And you can use the exports field instead of main, which gives you granular control.

Second thing is tests. You need to add these when you’re publishing things (again, I know this is all just practice but it’s good practice that you’re doing & you should follow it through). For stuff like this, as long as you have newest version of Node (v18) you get a test runner out of the box (and Node already has an assertion library built in). The Node runner is still experimental though, so using a different one is probably sensible: I’d personally advise uvu, which is stupidly simple and very very fast.

Once you’ve got that, third thing is CI, which you probably want to practice using: this a very good opportunity to do so. GitHub has it, use GitHub actions to run your tests, check dependencies are up to date, lint and format the code automatically, whatever you want.

There’s load of other stuff you can do here, but I’d advise all of the above, will keep you busy enough if you do!

Dope feedback! Thank you so much for the reply!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.