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
Converts a number to/from a human readable string:
1337↔1.34kB
Install
Download manually or with package-manager.
npm
npm install --save human-formatbower
bower install --save human-formatExample
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.16Contributions
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