()
| 18 | ); |
| 19 | } |
| 20 | render() { |
| 21 | const { num, abbr = false, animate = false } = this.props; |
| 22 | |
| 23 | if (num === undefined) { |
| 24 | return null; |
| 25 | } |
| 26 | |
| 27 | let content; |
| 28 | if (abbr) { |
| 29 | content = numeral(num).format('0a'); |
| 30 | if (animate) { |
| 31 | const match = content.match(/(?<val>[0-9]+)(?<suffix>[a-z]?)/); |
| 32 | if (match?.groups) { |
| 33 | const { val, suffix } = match.groups; |
| 34 | content = ( |
| 35 | <> |
| 36 | {this.renderAnimated(+val)} |
| 37 | {suffix} |
| 38 | </> |
| 39 | ); |
| 40 | } |
| 41 | } |
| 42 | } else { |
| 43 | content = animate ? ( |
| 44 | this.renderAnimated(num) |
| 45 | ) : ( |
| 46 | <FormattedNumber value={num} /> |
| 47 | ); |
| 48 | } |
| 49 | |
| 50 | return <span className="Numeric">{content}</span>; |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | export default injectIntl(Numeric); |
nothing calls this directly
no test coverage detected