Socket
Book a DemoInstallSign in
Socket

numberlabel

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

numberlabel

Convert a large number to nice formatted string.

1.0.1
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

Number Label

Node Version Downloads Travis

Convert a large number to nice formatted string.

Features

  • No dependencies
  • Easy to Use
  • Use the International System of Units (SI)

Installation

Module available through the npm registry. It can be installed using the npm or yarn command line tools.

# NPM
npm install numberlabel --save
# Or Using Yarn
yarn add numberlabel

Usage

const label = require('numberlabel')

//Amounts
label.amounts //[{pow, name, symbo, prefix...

//Convert(number, type[prefix, symbol, prefix], {start: 0, toFixed: 2})
label.convert(1567000, 'name') //''1.57 Million'
label.convert(1567000, 'symbol') //'1.27M'
label.convert(1567000, 'prefix') //'1.57 Mega'

label.convert(100, 'prefix', {start: 500}) //'100'
label.convert(100, 'prefix', {start: 500, toFixed: 4}) //'1.0000'
label.convert(100, 'prefix', {start: 500, toFixed: 4}) //'7.0000 Hecto'

label.convert(0.00101) //'1.01 Thousandth'

//getLabel(number, {start: 0, toFixed: 2, type: type[prefix, symbol, prefix]})
label.getLabel(100, {type: 'prefix'}) //{number:'1.00', pow: 2,...

Tests

To run the test suite, first install the dependencies, then run test:

# NPM
npm test
# Or Using Yarn
yarn test

Dependencies

None

  • bytelabel: convert byte lengths into a nice formatted string

Contributors

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue. List of all contributors.

License

MIT © Tiago Danin

Keywords

number

FAQs

Package last updated on 04 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.