https://github.com/dimitrinicolas/pretty-frame-rate
Transform a frame-rate value into an human readable string ("30000/1001" → "29.97fps")
https://github.com/dimitrinicolas/pretty-frame-rate
frame-rate pretty
Last synced: 4 months ago
JSON representation
Transform a frame-rate value into an human readable string ("30000/1001" → "29.97fps")
- Host: GitHub
- URL: https://github.com/dimitrinicolas/pretty-frame-rate
- Owner: dimitrinicolas
- License: mit
- Created: 2018-08-28T12:04:29.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-29T09:03:07.000Z (almost 8 years ago)
- Last Synced: 2025-02-03T10:05:49.464Z (over 1 year ago)
- Topics: frame-rate, pretty
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/pretty-frame-rate
- Size: 55.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# pretty-frame-rate [![Build Status][travis badge]][travis link] [![Coverage Status][coveralls badge]][coveralls link]
Transform a frame-rate value into an human readable string.
## Installation
```console
$ npm install pretty-frame-rate
```
## Usage
```js
const prettyFrameRate = require('pretty-frame-rate');
prettyFrameRate(30000 / 1001);
//=> '29.97fps'
prettyFrameRate('30000/1001');
//=> '29.97fps'
prettyFrameRate(60);
//=> '60fps'
prettyFrameRate(30000 / 1001, { decimals: 0 });
//=> '30fps'
prettyFrameRate(30, { suffix: 'ips' });
//=> '30ips'
```
The default options are:
```js
const DEFAULT_OPTIONS = {
decimals: 2,
suffix: 'fps'
};
```
## Related
- [pretty-ms][pretty-ms] - Convert milliseconds to a human readable string:
`1337000000` → `15d 11h 23m 20s`
- [pretty-bytes][pretty-bytes] - Convert bytes to a human readable string:
1337 → 1.34 kB
## License
This project is licensed under the [MIT license](LICENSE).
[travis badge]: https://travis-ci.com/dimitrinicolas/pretty-frame-rate.svg?branch=master
[travis link]: https://travis-ci.com/dimitrinicolas/pretty-frame-rate
[coveralls badge]: https://coveralls.io/repos/github/dimitrinicolas/pretty-frame-rate/badge.svg?branch=master
[coveralls link]: https://coveralls.io/github/dimitrinicolas/pretty-frame-rate?branch=master
[pretty-ms]: https://github.com/sindresorhus/pretty-ms
[pretty-bytes]: https://github.com/sindresorhus/pretty-bytes