JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8577
  • Score
    100M100P100Q127358F
  • License MIT

Converts numbers into a more human-friendly format. For example, 123456 becomes '123k'.

Package Exports

  • approximate-number

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (approximate-number) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Build Status

Converts 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, browsers, and on the command line.

Getting Started

Install node module with: npm install approximate-number

var approx = require('approximate-number');
approx(123456) // 123k

Or use the browser module with: bower install approximate-number

<script src="/bower_components/approximate-number/lib/approximate-number.js"></script>
<script>
alert(approximateNumber(1234567890)); // 1.2b
</script>

Or install with -g for command line usage

$ npm install -g approximate-number
$ approximate-number 78910 #78k

See tests for more examples.

License

Copyright (c) 2014 Nathan Friedly
Licensed under the MIT license.