Socket
Socket
Sign inDemoInstall

aveta

Package Overview
Dependencies
16
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    aveta

Convert long numbers into abbreviated and human-readable strings.


Version published
Weekly downloads
390
increased by20.37%
Maintainers
1
Created
Weekly downloads
 

Readme

Source


logo

Convert long numbers into abbreviated and human-readable strings on an easy way.
Input :disappointed:Value :joy:
6000'6K'
10000'10km'
42500'42.5 kg'
1250000'1.25 MB'

Install

Get it on npm

npm install aveta

Get it on yarn

yarn add  aveta

Usage

aveta(value: number, options: IOptions)
import aveta from 'aveta';

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

aveta(8700); // 8.7K

aveta(123456, {
  digits: 3,
  lowercase: true,
});
// 123k
aveta(4567, {
  digits: 3,
  lowercase: true,
});
// 4.57k
aveta(2048000, {
  precision: 2,
  lowercase: true,
});
// 2.48m

aveta(45500, {
  precision: 3,
  separator: ',',
});
// 4,550K

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

Command Line

$ aveta 234000
// or
$ npx aveta 234000
234K

See aveta --help for options.

Default Options

NameTypeDefaultDescription
precisionnumber1Number of significant digits
digitsnumber0Number of digits
separatorstring'.'Desired decimal separator (e.g. decimal point or comma)
lowercasebooleanfalseUse lowercase abbreviations
spacebooleanfalseAdd a space between number and abbreviation
unitsArray<string>['', 'K', 'M', 'B', 'T', 'P', 'E']Unit abbreviations

Units

aveta allows you custom your own units for your project.

That is amazing aveta ! :joy:


MIT License

Authors

Mhammed Talhaouy

Keywords

FAQs

Last updated on 24 Mar 2023

Did you know?

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc