Skip to content

Latest commit

 

History

History
41 lines (32 loc) · 953 Bytes

README.md

File metadata and controls

41 lines (32 loc) · 953 Bytes

Quantity with (sub)multipliers to real numbers

A library for converting quantities with multipliers to real numbers. Motivated by Kubernetes' API machinery quantity.

Installation

npm install @ragnarpa/quantity

Example usage

const { real } = require("@ragnarpa/quantity");

const giga = real("10G");
const gibi = real("100Gi");
const micro = real("1000u");

console.log(giga, gibi, micro);

Supported (sub)multipliers

Multiplier Unit prefix
n nano
u micro
m milli
k kilo
M mega
G giga
T tera
P peta
E exa
Ki kibi
Mi mebi
Gi gibi
Ti tebi
Pi pebi
Ei exbi