Skip to content

Repository files navigation

KBN

KBN is a library that was created to scale and format numbers with common units. KBN is still in the early stages of development, so it may not be useful yet.

For more information, contact Netuitive support at support@netuitive.com.

Installing and Building KBN

Install

bower install https://github.com/Netuitive/kbn#master

Production Build

gulp production

Testing KBN

gulp

Using KBN

API

  • The below command will attempt to find a unit based on a given string.

     kbn.findUnitFormat(unit)
    
  • The below command will scale the given value by the given unit, round to 4 significant digits, and return a string representation of the value with the scaled units.

     kbn.formatValue(value, unit)
    

Supported Units

Supported unit codes recognized by the formatValue api call:

General

CodeUnit
shortshort
percentpercent (0-100)
percentunitpercent (0.0-1.0)
humidityHumidity (%H)
ppmppm
dBdecibel

Data

CodeUnit
bitsbits
bytesbytes (base2)
bytesdbytes (base10)
kbyteskilobytes
kibyteskibibytes
mbytesmegabytes
mibytesmebibytes
gbytesgigabytes
gibytesgibibytes

Data Rate

CodeUnit
ppspackets/sec
bpsbits/sec
Bpsbytes/sec
kBpskilobytes/sec
mBpsmegabytes/sec
gBpsgigabytes/sec

Time

CodeUnit
hertzHertz (1/s)
nsnanoseconds (ns)
µsmicroseconds (µs)
msmilliseconds (ms)
sseconds (s)
mminutes (m)
hours(h)
ddays (d)

Throughput

CodeUnit
opsops/sec (ops)
rpsreads/sec (rps)
wpswrites/sec (wps)
iopsI/O ops/sec (iops)

Memory

CodeUnit
fpsfaults/sec (fps)
Ppspages/sec (Pps)

Currency

CodeUnit
currencyUSDDollars ($)
currencyGBPPounds (£)
currencyEUREuro (€)
currencyJPYYen (¥)

Length

CodeUnit
lengthmmmillimetre (mm)
lengthmmeter (m)
lengthkmkilometer (km)
lengthmimile (mi)

Velocity

CodeUnit
velocitymsm/s
velocitykmhkm/h
velocitymphmph
velocityknotknot (kn)

Volume

CodeUnit
mlitremillilitre
litrelitre
m3cubic metre

Energy

CodeUnit
wattwatt (W)
kwattkilowatt (kW)
watthwatt-hour (Wh)
kwatthkilowatt-hour (kWh)
joulejoule (J)
evelectron volt (eV)
ampAmpere (A)
voltVolt (V)

Temperature

CodeUnit
celsiusCelcius (°C)
farenheitFarenheit (°F)
kelvinKelvin (K)

Pressure

CodeUnit
pressurembarMillibars
pressurehpaHectopascals
pressurehgInches of mercury
pressurepsiPSI

Additional Information

KBN was originally imported from Graphana.

About

Library to scale and format numbers with common units.

Resources

Contributing

Stars

2 stars

Watchers

11 watching

Forks

Releases

Packages

Contributors

Languages