Gathering detailed insights and metrics for approximate-number
Gathering detailed insights and metrics for approximate-number
Gathering detailed insights and metrics for approximate-number
Gathering detailed insights and metrics for approximate-number
@types/approximate-number
TypeScript definitions for approximate-number
cubic2quad
Approximate cubic Bezier curve with a number of quadratic ones
approx
Give me an approximate number around this one (for setTimeout/setInterval etc).
time2read
Approximate number of milliseconds it takes to read a string.
Converts numbers into a more human-friendly format. E.g. 123456 becomes 123k. Similar to `ls -lh` or Stack Overflow's reputation numbers.
npm install approximate-number
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
38 Stars
93 Commits
6 Forks
2 Watchers
3 Branches
4 Contributors
Updated on Jun 02, 2025
Latest Version
2.1.1
Package Id
approximate-number@2.1.1
Unpacked Size
9.89 kB
Size
3.45 kB
File Count
6
NPM Version
9.8.0
Node Version
20.5.0
Published on
Jul 26, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Abbreviates numbers into a more human-friendly format, similar to ls
's --human-readable
flag (ls -lh
) or Stack
Overflow's reputation numbers. For example, 123456 becomes '123k'.
Works in Node.js and in browsers.
1var approx = require('approximate-number'); 2 3console.log(approx(1234)); 4//> 1.2k 5 6console.log(approx(12345)); 7//> 12k 8 9console.log(approx(1234, {decimal: false})); 10//> 1k 11 12console.log(approx(1234, {decimal: ','})); 13//> 1,2k 14 15console.log('My Stack Overflow reputation is %s.', approx(3671, { 16 min10k: true 17})); 18//> My Stack Overflow reputation is 3,671. 19 20console.log('The US national debt is %s.', approx(19939034457936, { 21 prefix: '$', 22 capital: true, 23 round: true 24})); 25// > The US national debt is $20T. 26 27// Truncates/floors numbers by default 28approx(9999); 29// > '9.9k' 30 31// Set `round: true` to round instead of floor. 32approx(9999,{round: true}); 33// > '10k' 34
Install node module with: npm install --save approximate-number
1var approx = require('approximate-number'); 2approx(123456) // 123k
Install with: bower install approximate-number
1<script src="/bower_components/approximate-number/lib/approximate-number.js"></script> 2<script> 3alert(approximateNumber(1234567890)); // 1.2b 4</script>
Grab the latest approximate-number.js and copy it onto your site.
','
. Thousands separator - set to a string (e.g. '.') to use that string or false to not use any separator.'.'
. Decimal - set to a string (e.g. ',') to use that or set to false to avoid outputting values with a decimal.false
. Round numbers off rather than flooring/truncating. When true, 105000 would become '11m', when false it becomes '10m'.false
. Do not abbreviate numbers below 10000. E.g. 9999 would become '9,999' rather than '9k'. (Stack Overflow-style).''
. Optional string to prepend to the value, e.g. '$'.''
. Optional string to append to the value, e.g. '%'.false
. Set to true to use capital letters, e.g. 3.9M instead of 3.9moptions.round=true
.options.min10k=true
.Copyright (c) 2014 Nathan Friedly
Licensed under the MIT license.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
2 existing vulnerabilities detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
Reason
Found 2/15 approved changesets -- score normalized to 1
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
1 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More