Skip to content

Commit

Permalink
📖 Custom Zero and Null Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Bunlong committed Sep 26, 2020
1 parent 0ca0431 commit cc441af
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,24 @@ number.format();
// '$1,000.00'
```

#### Custom Zero and Null Formatting

Set a custom output when formatting numerals with a value of 0 or null

```js
const number = numeral(0);
const nullNumber = numeral(null);

numeral.zeroFormat('N/A');
numeral.nullFormat('N/A');

const zero = number.format('0.0')
// 'N/A'

const na = nullNumber.format('0.0')
// 'N/A'
```

## ❗ Issues

If you think any of the `Numeral` can be improved, please do open a PR with any updates and submit any issues. Also, I will continue to improve this, so you might want to watch/star this repository to revisit.
Expand Down

0 comments on commit cc441af

Please sign in to comment.