JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 84217
  • Score
    100M100P100Q149406F
  • 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 Dependency Status devDependency 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

bower

bower 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, {
    prefixes: humanFormat.makePrefixes(
        // Array of consecutive prefix.
        ',ki,Mi,Gi,Ti,Pi'.split(','),

        // Base.
        1024
    )
});
//=> 3.14TiB

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

Contributions

Contributions are very welcomed, either on the documentation or on the code.

You may:

  • report any issue you've encountered;
  • fork and create a pull request.

License

ISC © Julien Fontanet