A Dart library to convert values into human-friendly representations.
When writing user interfaces we often want to present data we have in a raw format in a way that makes sense to the end user, but doing so is often non-trivial. This library aims to make such conversions easy and flexible.
Firstly, install the humanizer package, then you can import Humanizer into your Dart code as follows:
This library has a broad API surface, and in fact has multiple API layers as discussed here. The following table gives a high level overview of the various features, with links to deeper discussion:
Duration to a human-friendly approximation.
|Converts an integral value to cardinal form (
|Converts an integral value to ordinal form (
|Alters the plurality of an input word.
|Converts input strings to
Sentence case or
|Intelligently truncates input strings.
|Converts programming symbol names into human-friendly representations.
|Units of measurement
|Provides types to represent common units of measurement and the ability to convert those types to a human-readable form.
Note that whilst this library is locale-aware, it currently only includes an English implementation.
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!
Special thanks to these inspirational open source libraries: