All Projects → izolate → millify

izolate / millify

Licence: MIT license
Convert long numbers to pretty, human-readable strings

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to millify

fp-units
An FP-oriented library to easily convert CSS units.
Stars: ✭ 18 (-84.87%)
Mutual labels:  units
benchmarkjs-pretty
Tiny wrapper around benchmarkjs with a nicer api
Stars: ✭ 20 (-83.19%)
Mutual labels:  pretty
tmux
💽 Soothing pastel theme for Tmux!
Stars: ✭ 63 (-47.06%)
Mutual labels:  pretty
Unchained
A fully type safe, compile time only units library.
Stars: ✭ 70 (-41.18%)
Mutual labels:  units
measured
Type-safe, intuitive units of measure
Stars: ✭ 81 (-31.93%)
Mutual labels:  units
uLogMe
📊 📈 Automatically collect and visualize usage statistics on Ubuntu, with 🎹 key frequencies and 💻 window titles →
Stars: ✭ 61 (-48.74%)
Mutual labels:  pretty
cpc
Text calculator with support for units and conversion
Stars: ✭ 89 (-25.21%)
Mutual labels:  units
DustryX
More more content for you
Stars: ✭ 24 (-79.83%)
Mutual labels:  units
AbbrevMan.nvim
🍍 A NeoVim plugin for managing vim abbreviations.
Stars: ✭ 82 (-31.09%)
Mutual labels:  abbreviations
physikal
Mirror of Gitlab Repository
Stars: ✭ 33 (-72.27%)
Mutual labels:  units
prettysize-rs
Pretty-print file sizes and more
Stars: ✭ 29 (-75.63%)
Mutual labels:  units
Making-elegant-Matlab-figures
A repository comprising multiple functions for making elegant publication-quality figures in MATLAB
Stars: ✭ 44 (-63.03%)
Mutual labels:  pretty
Mimir
📱 A simple & efficient iOS logging framework for high usage apps
Stars: ✭ 13 (-89.08%)
Mutual labels:  pretty
l
Golang Pretty Logger
Stars: ✭ 51 (-57.14%)
Mutual labels:  pretty
millify
Convert long numbers into a human-readable format in Python
Stars: ✭ 64 (-46.22%)
Mutual labels:  human-readable
json-peek
Stringify JSON *just enough* to see what it is
Stars: ✭ 33 (-72.27%)
Mutual labels:  pretty
paper-terminal
Print Markdown to a paper in your terminal
Stars: ✭ 33 (-72.27%)
Mutual labels:  pretty
state-codes
Brazilian states 2-letter codes (ISO 3166-2:BR), official abbreviations throughout the country's history
Stars: ✭ 23 (-80.67%)
Mutual labels:  abbreviations
UnitfulAstro.jl
An extension of Unitful.jl for astronomers.
Stars: ✭ 18 (-84.87%)
Mutual labels:  units
fish-abbreviation-tips
💡 Help you remembering your abbreviations
Stars: ✭ 155 (+30.25%)
Mutual labels:  abbreviations

Millify

Converts long numbers into pretty, human-readable strings.

Before 😒 After 🎉
2000 '2K'
10000 '10k'
42500 '42.5 kg'
1250000 '1.25 MB'
2700000000 '2.7 bil'

Install

Get it on npm:

npm install millify

Usage

Command line

$ millify 12345
12.3K

See millify --help for options.

Programmatically

millify(value: number, options: MillifyOptions)

import millify from "millify";

// For CommonJS: `const { millify } = require("millify");`

millify(2500); // 2.5K

millify(1024000, {
  precision: 3,
  lowercase: true
});
// 1.024m

millify(39500, {
  precision: 2,  
  decimalSeparator: ","
});
// 3,95K

millify(1440000, {
  units: ["B", "KB", "MB", "GB", "TB"],
  space: true,
});
// 1.44 MB

Options

Name Type Default Description
precision number 1 Number of decimal places to use
decimalSeparator string '.' Desired decimal separator (e.g. decimal point or comma)
lowercase boolean false Use lowercase abbreviations
space boolean false Add a space between number and abbreviation
units Array<string> ['', 'K', 'M', 'B', 'T', 'P', 'E'] Unit abbreviations
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].