DEV Community

Zell Liew πŸ€—
Zell Liew πŸ€—

Posted on β€’ Originally published at zellwk.com

8 4

A JavaScript Utility... Library?

I complied a list of useful JavaScript stuff into a Github repository.

This repository includes code for functions like:

And many others.

You can install the entire library with npm.

npm install @zellwk/javascript
Enter fullscreen mode Exit fullscreen mode

Why this format?

I prefer publishing JavaScript stuff into one repository instead of splitting them into many small ones because:

  1. It's easier for me to maintain – everything is in one place
  2. It's easier for me to install – again, everything is in one place. No need to npm install a bajillion amount of libraries.

I was hesitant about releasing this library at first. It felt stupid. I thought nobody wouldn't use this collection anyway. I thought people prefer the current way where we install one small package each time with npm.

But Shawn Wang convinced me otherwise. He said it's okay as long as the library is treeshakable. Which makes sense. Shawn also told me Rich Harris had a similar thing called Yootils.

This idea gave me the permission to release this repository publicly, which is why I'm sharing this with you today. If you find this collection useful, please also give some credit to Shawn for expanding my thoughts.


Thanks for reading. This article was originally posted on my blog. Sign up for my newsletter if you want more articles to help you become a better frontend developer.

Top comments (0)

typescript

11 Tips That Make You a Better Typescript Programmer

1 Think in {Set}

Type is an everyday concept to programmers, but it’s surprisingly difficult to define it succinctly. I find it helpful to use Set as a conceptual model instead.

#2 Understand declared type and narrowed type

One extremely powerful typescript feature is automatic type narrowing based on control flow. This means a variable has two types associated with it at any specific point of code location: a declaration type and a narrowed type.

#3 Use discriminated union instead of optional fields

...

Read the whole post now!

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay