JSPM

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

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.

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'. See tests for more examples.

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(approximate(1234567890)); // 1.2b
</script>

Or install with -g for command line usage

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

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

License

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