Number cleaner
(1,234.56) · 1.234,56 · 1,234.56- · $ 1 234.56 · 1.2k → clean signed values, one per line.
- Runs
- In this tab
- Data sent
- None
- Rounding
- Once, at the end
- Also in
- The Chrome extension
Number cleaner, worked
Showing a worked example — type over it
Result
How the number cleaner works.
Number cleaner: paste anything a report throws at you — (1,234.56), 1.234,56, 1,234.56-, $ 1 234.56, 1.2k — get clean signed values, one per line, ready for the tape or Excel.
Quoted from the toolbelt spec, the document this tool was built against.
Where these numbers come from.
Negatives are parenthesised because that is what a statement does. The rest is four promises.
Minor units, never floats
Amounts are integers in the currency's smallest unit, end to end. A float never touches a cent.
Rounded once
Rounded once, at the end — never per operand, which is how a split stops summing to the whole.
Unit tested
The arithmetic lives in one unit-tested module, shared without reimplementation with the extension.
No network
There is no request to make. What you type stays in this tab and is gone when you close it.
More in data hygiene
The same number, elsewhere.
A calculator answers the question once. These carry the answer into a product, name what it computed, and argue the method.
- ComponentMoneyThe core primitive. A monetary value, formatted correctly.
- ComponentTransactionTableThe workhorse. Virtualized, sticky, priority-collapsing.
- ComponentStatementTableThe shared shell: hierarchy, periods, rules.
- TermBasisCash or accrual
- DocNumericsThe document that makes this a finance system rather than a dashboard kit. Everything here is a rule the rest of the library enforces on the consumer's behalf.
- DocCurrency decimal placesHow many decimals each ISO 4217 code is stored at — JPY 0, USD 2, KWD 3.