https://github.com/mckomo/dynamic-numeral
Dynamic formats for https://github.com/adamwdraper/Numeral-js
https://github.com/mckomo/dynamic-numeral
dynamic-formats javascript numeral numeraljs typescript
Last synced: 19 days ago
JSON representation
Dynamic formats for https://github.com/adamwdraper/Numeral-js
- Host: GitHub
- URL: https://github.com/mckomo/dynamic-numeral
- Owner: mckomo
- License: mit
- Created: 2019-04-19T16:40:37.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-06-11T12:47:58.000Z (over 1 year ago)
- Last Synced: 2025-01-21T17:17:24.324Z (12 months ago)
- Topics: dynamic-formats, javascript, numeral, numeraljs, typescript
- Language: TypeScript
- Homepage:
- Size: 472 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# dynamic-numeral
[](https://travis-ci.org/mckomo/dynamic-numeral)
Dynamic formats for [Numeral.js](https://github.com/adamwdraper/Numeral-js).
# Usage
First register new format with Numeral.js.
```js
import 'dynamic-numeral/register-format';
```
Now you can use dynamic formats:
```js
const format = "0.01|1.0";
numeral(0.656).format(format); // 0.66
numeral(1.65).format(format); // 1.7
```
Check [tests](https://github.com/mckomo/dynamic-numeral/blob/master/test/registration.test.ts) for more examples.