New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

millify

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

millify

Converts long numbers to pretty, human-readable strings

  • 6.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
141K
decreased by-3.74%
Maintainers
1
Weekly downloads
 
Created

What is millify?

The millify npm package is used to convert large numbers into human-readable strings by formatting them with appropriate units (e.g., thousands, millions, billions). It is particularly useful for displaying large numbers in a compact and understandable format.

What are millify's main functionalities?

Basic Number Formatting

This feature allows you to convert a large number into a more readable format by appending a unit suffix. In this example, the number 1,234,567 is converted to '1.23M'.

const millify = require('millify');
console.log(millify(1234567)); // Output: '1.23M'

Custom Precision

Millify allows you to specify the precision of the formatted number. In this example, the precision is set to 1, resulting in '1.2M' instead of the default '1.23M'.

const millify = require('millify');
console.log(millify(1234567, { precision: 1 })); // Output: '1.2M'

Custom Units

You can customize the units used for formatting. This example shows how to specify custom units, although the output remains the same as the default units in this case.

const millify = require('millify');
console.log(millify(1234567, { units: ['K', 'M', 'B', 'T'] })); // Output: '1.23M'

Other packages similar to millify

Keywords

FAQs

Package last updated on 12 Mar 2023

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

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc