remove-trailing-zeros
v1.0.3
Published
Remove trailing zeros from a string/number
Downloads
2,488
Readme
Remove Trailing Zeros
Remove extra zeros from the end of a string or number.
Performance benchmark: https://jsperf.com/remove-trailing-zeros
Installation
yarn add remove-trailing-zeros
Usage
import removeTrailingZeros from 'remove-trailing-zeros'
console.log('Are the same:', removeTrailingZeros('1,230.4000'')) // -> 1,230.4
Examples
1 -> 1
10 -> 10
100. -> 100
100.0 -> 100
100.1 -> 100.1
100.10 -> 100.1
100.01 -> 100.01
100.010 -> 100.01
'1.2304000' -> 1.2304
'1,000.000' -> 1,000
License
ISC
Changelog
- 1.0.3 - Manually put in an AMD build - TODO: generate this
- 1.0.2 - Removed let and used var instead, to stop build errors
- 1.0.0 - Initial release