finds.dev← search

// the find

HubSpot/humanize

★ 919 · JavaScript · MIT · updated Nov 2023

A simple utility library for making the web more humane. #hubspot-open-source

A JavaScript utility library for formatting numbers, strings, and arrays into human-readable output — ordinals, file sizes, oxford commas, compact integers, and similar display helpers. It's a HubSpot internal tool that got open-sourced. Useful if you need several of these formatters and don't want to pull in separate micro-packages.

The oxford comma formatter handles edge cases (pluralization, custom overflow text) that most roll-your-own implementations miss. The `compactInteger` function gracefully falls back to scientific notation for numbers beyond trillions, which is a sensible design choice. The `pace` function for slow-rate descriptions is genuinely useful for dashboards showing infrequent events. Single-file source with no runtime dependencies.

Last touched in 2023 and the Travis CI badge links to a service that's effectively defunct — there's no signal that this is actively maintained. The source is written in what was CoffeeScript compiled to JS; the current repo ships pre-compiled JavaScript in `src/`, which is confusing and makes contribution awkward. No locale/i18n support for number formatting — `intComma` always uses commas and periods, so it breaks for European locales. `fileSize` uses binary calculation but labels output as 'Kb'/'Mb'/'Gb' (not 'KiB'/'MiB'), which is the classic SI/IEC mix-up that will confuse anyone who cares about the distinction.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →