Stop being the product.
Become the owner.
or
sign uplog in

#Built a tiny JS utility library to make data…

#Built a tiny JS utility library to make data human-readable — would love feedback!

Hey folks,

I recently built a small TypeScript utility package called `humanize-this`. It helps convert machine data into more human-friendly formats — like turning `2048` into `"2 KB"` or `"2024-01-01"` into `"5 months ago"`.

It started as a personal itch while working on dashboards and logs. I was tired of rewriting these tiny conversions in every project, so I bundled them up.

# 🛠️ What it does

* `humanize.bytes(2048)` → `"2 KB"`
* `humanize.time(90)` → `"1 min 30 sec"`
* `humanize.ordinal(3)` → `"3rd"`
* `humanize.timeAgo(new Date(...))` → `"5 min ago"`
* `humanize.currency(123456)` → `"₹1.23L"`
* `humanize.slug("Hello World!")` → `"hello-world"`
* `humanize.url("https://github.com/...")` → `"github.com › repo › file"`
* `humanize.pluralize("apple", 2)` → `"2 apples"`
* `humanize.diff(date1, date2)` → `"3 days"`
* `humanize.words("hello world again", 2)` → `"hello world..."`

It’s 100% TypeScript, zero dependencies, and I’ve written tests for each method using Vitest.

npm install humanize-this

github.com/Shuklax/humanize-this

Honestly, I don’t know if this will be useful to others, but it helped me clean up some code and stay DRY. I’d really appreciate:

* Feedback on API design
* Suggestions for more “humanize” utilities
* Critique on packaging or repo setup

Thanks in advance. Happy to learn from the community 🙏
#programming #technology #js #dev
loved
5
earnings
12,000 mlx total
$0  total
engagement
15 views
5 reactions

0 comments