JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 80392
  • Score
    100M100P100Q152677F
  • License ISC

Converts a number to/from a human readable string: `1337` ↔ `1.34kB`

Package Exports

  • human-format

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 (human-format) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

human-format Build Status

Converts a number to/from a human readable string: 13371.34kB

Install

Download manually or with package-manager.

npm

npm install --save human-format

Example

humanFormat(1337);
//=> '1.34kB'

// Custom units can be used.
humanFormat(65536, { unit: 'm' });
//=> 65.54km

// Custom prefixes with custom bases can be used!
humanFormat(3452466511216.64, {
    unit: 'iB',
    prefixes: humanFormat.makePrefixes(
        ',k,M,G,T,P'.split(','),
        1024
    )
});
//=> 3.14TiB

// You can also parses a human readable string.
humanFormat.parse('1.34kB');
//=> 1372.16

License

ISC © Julien Fontanet