npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

short-scale-units

v1.2.0

Published

A simple package providing helper functions for matching numbers with their _short scale unit_. And formatting the numbers, or the unit values

Downloads

52

Maintainers

mudlabsmudlabs

Keywords

NumbersShortScaleUnitsPowerThousandMillionBillionTrillionQuadrillionQuintillionSextillionSeptillionOctillionNonillionDecillionUndecillionDuodecillionTredecillionQuattuordecillionQuindecillionSexdecillionSeptendecillionOctodecillionNovemdecillionVigintillionUnvigintillionDuovigintillionTrevigintillionQuattuorvigintillionQuinvigintillionSexvigintillionSeptenvigintillionOctovigintillionNovemvigintillionTrigintillionUntrigintillionDuotrigintillionTretrigintillionQuattuortrigintillionQuintrigintillionSextrigintillionSeptentrigintillionOctotrigintillionNovemtrigintillionQuadragintillionUnquadragintillionDuoquadragintillionTrequadragintillionQuattuorquadragintillionQuinquadragintillionSexquadragintillionSeptenquadragintillionOctoquadragintillionNovemquadragintillionQuinquagintillionUnquinquagintillionDuoquinquagintillionTrequinquagintillionQuattuorquinquagintillionQuinquinquagintillionSexquinquagintillionSeptenquinquagintillionOctoquinquagintillionNovemquinquagintillionSexagintillionUnsexagintillionDuosexagintillionTresexagintillionQuattuorsexagintillionQuinsexagintillionSexsexagintillionSeptsexagintillionOctosexagintillionNovemsexagintillionSeptuagintillionUnseptuagintillionDuoseptuagintillionTreseptuagintillionQuattuorseptuagintillionQuinseptuagintillionSexseptuagintillionSeptseptuagintillionOctoseptuagintillionNovemseptuagintillionOctogintillionUnoctogintillionDuooctogintillionTreoctogintillionQuattuoroctogintillionQuinoctogintillionSexoctogintillionSeptoctogintillionOctooctogintillionNovemoctogintillionNonagintillionUnnonagintillionDuononagintillionTrenonagintillionQuattuornonagintillionQuinnonagintillionSexnonagintillionSeptnonagintillionOctononagintillionNovemnonagintillionCentillion

Readme

npm size support

Short Scale Units

A simple package providing helper functions for matching numbers with their short scale unit.

Table of Context

Installation

npm install short-scale-units

Import/Require

// TypeScript
import * as ssu from "short-scale-units";
// JavaScript
const ssu = require("short-scale-units");

API

unitNameFromNumber

Provides the English unit name for the given number.

const name = ssu.unitNameFromNumber(17388);
// name = "thousand"

numberFromUnitName

Provides the base unit number for the given unit name.

const integer = ssu.numberFromUnitName("thousand");
const notation = ssu.numberFromUnitName("sextillion");
const raw = ssu.numberFromUnitName("sextillion", true);
// number = 1000
// notation = 1e+21
// raw = "1000000000000000000000"

trimNumber

Provides the short-hand abbreviation of a number, relative to its unit.

const trimmed = ssu.trimNumber(17388);
// trimmed = 17 (because 17388 is 17 thousands)

trimName

Provides an abbreviation of the unit name;

const abbreviation = trimName("thousand");
// abbreviation = "K"

getUnitPower

Provides the power for the given number, relative to its unit.

  • If you want the numbers real power use getPower.
const unitPower = ssu.getUnitPower(17388);
// unitPower = 3

getPower

Provides the power for the given number.

  • If you want the power relative the its unit use getUnitPower.
const powerRound = ssu.getPower(17388, true);
const power = ssu.getPower(17388);
// powerRound = 4
// power = 4.240249631518799

Supported Units

| Unit Name | Unit Power | Unit Abbreviation | | --------- | ---------- | ----------------- | | one | 0 | O | | ten | 1 | T | | hundred | 2 | H | | thousand | 3 | K | | million | 6 | M | | billion | 9 | B | | trillion | 12 | Tr | | quadrillion | 15 | Qd | | quintillion | 18 | Qt | | sextillion | 21 | Sxt | | septillion | 24 | Spt | | octillion | 27 | Ot | | nonillion | 30 | Nn | | decillion | 33 | Dc | | undecillion | 36 | Ud | | duodecillion | 39 | Dd | | tredecillion | 42 | Td | | quattuordecillion | 45 | Qtd | | quindecillion | 48 | Qnd | | sexdecillion | 51 | Sxd | | septendecillion | 54 | Std | | octodecillion | 57 | Od | | novemdecillion | 60 | Nd | | vigintillion | 63 | V | | unvigintillion | 66 | Uv | | duovigintillion | 69 | Dv | trevigintillion | 72 | Tv | | quattuorvigintillion | 75 | Qtv | | quinvigintillion | 78 | Qnv | | sexvigintillion | 81 | Sxv | | septenvigintillion | 84 | Stv | | octovigintillion | 87 | Ov | | novemvigintillion | 90 | Nv | | trigintillion | 93 | Tg | | untrigintillion | 96 | Utg | | duotrigintillion | 99 | Dtg | | tretrigintillion | 102 | Ttg | | quattuortrigintillion | 105 | Qttg | | quintrigintillion | 108 | Qntg | | sextrigintillion | 111 | Sxtg | | septentrigintillion | 114 | Sttg | | octotrigintillion | 117 | Otg | | novemtrigintillion | 120 | Ntg | | quadragintillion | 123 | Qdr | | unquadragintillion | 126 | Uqdr | | duoquadragintillion | 129 | Dqdr | | trequadragintillion | 132 | Tqdr | | quattuorquadragintillion | 135 | Qtqdr | | quinquadragintillion | 138 | Qnqdr | | sexquadragintillion | 141 | Sxqdr | | septenquadragintillion | 144 | Stqdr | | octoquadragintillion | 147 | Oqdr | | novemquadragintillion | 150 | Nqdr | | quinquagintillion | 153 | Qng | | unquinquagintillion | 156 | Uqng | | duoquinquagintillion | 159 | Dqng | | trequinquagintillion | 162 | Tqng | | quattuorquinquagintillion | 165 | Qtqng | | quinquinquagintillion | 168 | Qnqng | | sexquinquagintillion | 171 | Sxqng | | septenquinquagintillion | 174 | Stqng | | octoquinquagintillion | 177 | Oqng | | novemquinquagintillion | 180 | Nqng | | sexagintillion | 183 | Sxa | | unsexagintillion | 186 | Usxa | | duosexagintillion | 189 | Dsxa | | tresexagintillion | 192 | Tsxa | | quattuorsexagintillion | 195 | Qtsxa | | quinsexagintillion | 198 | Qnsxa | sexsexagintillion | 201 | Sxsxa | | septsexagintillion | 204 | Stsxa | | octosexagintillion | 207 | Osxa | | novemsexagintillion | 210 | Nsxa | | septuagintillion | 213 | Spg | | unseptuagintillion | 216 | Uspg | | duoseptuagintillion | 219 | Dspg | | treseptuagintillion | 222 | Tspg | | quattuorseptuagintillion | 225 | Qtspg | | quinseptuagintillion | 228 | Qnspg | | sexseptuagintillion | 231 | Sxspg | | septseptuagintillion | 234 | Stspg | | octoseptuagintillion | 237 | Ospg | | novemseptuagintillion | 240 | Nspg | | octogintillion | 243 | Og | | unoctogintillion | 246 | Uog | | duooctogintillion | 249 | Dog | | treoctogintillion | 252 | Tog | | quattuoroctogintillion | 255 | Qtog | | quinoctogintillion | 258 | Qnog | | sexoctogintillion | 261 | Sxog | | septoctogintillion | 264 | Stog | | octooctogintillion | 267 | Oog | | novemoctogintillion | 270 | Nog | | nonagintillion | 273 | Ng | | unnonagintillion | 276 | Ung | | duononagintillion | 279 | Dng | | trenonagintillion | 282 | Tng | | quattuornonagintillion | 285 | Qtng | | quinnonagintillion | 288 | Qnng | | sexnonagintillion | 291 | Sxng | | septnonagintillion | 294 | Stng | | octononagintillion | 297 | Ong | | novemnonagintillion | 300 | Nng | | centillion | 303 | C |