Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
js-abbreviation-number
Advanced tools
Abbreviate numbers in javascript
npm install js-abbreviation-number
import { abbreviateNumber } from "js-abbreviation-number";
const num = abbreviateNumber(1000, 1); // expected 1.0K
const num = abbreviateNumber(12, 0); // expected 12
const num = abbreviateNumber(1111, 2); // expected 1.11K
const num = abbreviateNumber(1234.56, 1); // expected 1.2K
abbreviateNumber(num: number, digit?: number, symbols?: Array<string>): string
The symbols
is optional. It can be an array of units, defaulting to ["", "K", "M", "G", "T", "P", "E"]
.
digit
is also optional. It defaults to 1.
Thank you for your interest in contributing! Please feel free to put up a PR for any issue or feature request.
If you think this project is helpful just give me a ⭐️ Star is enough because i don't drink coffee 😃
This project is licensed under the MIT License - see the LICENSE.md file for details
Made with ❤️ by Mohsen Madani.
FAQs
Abbreviate numbers in javascript
The npm package js-abbreviation-number receives a total of 9,594 weekly downloads. As such, js-abbreviation-number popularity was classified as popular.
We found that js-abbreviation-number demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.