JsCommunity / JsCommunity/human-format

Is there a way to always floor the result?

Open
#46 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
100
Forks
22
PR merge metrics
No merged PRs in 30d

Description

Hello,
Is there an option to specify the library should always floor the rounding?
Currently 1390 gets displayed as 1.4k, I would like for it to show 1.3k while the input value is strictly less than 1400.

In other words, I'd like to never show a value actually higher than the input.

Just for reference, the options I'm currently using are { maxDecimals: 'auto', separator: '' }.

Thank you.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported behavior in the human-format library with input 1390 and options { maxDecimals: 'auto', separator: '' }. Trace the rounding path and determine how an always-floor behavior should be exposed. Done means values below 1400 display no higher than the input while existing formatting behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.