https://github.com/toddself/round
Round numbers
https://github.com/toddself/round
Last synced: 8 months ago
JSON representation
Round numbers
- Host: GitHub
- URL: https://github.com/toddself/round
- Owner: toddself
- License: other
- Created: 2015-11-02T04:01:50.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-11-02T04:14:24.000Z (over 10 years ago)
- Last Synced: 2025-03-15T05:12:05.189Z (over 1 year ago)
- Language: JavaScript
- Size: 121 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/toddself/round)
# round
Round numbers to a specified number of signficant digits or return a 0
## ES6 Module!
This is authored as an ES6 module and relies on ES6 features. The `main` key in `package.json` points to the transpiled ES5 source, but the `jsnext:main` key points to the ES6 original source. If your environement supports:
* block scoping (`let` & `const`)
* ES6 `import` and `export`
Then feel free to use the ES6 source directly.
## Usage
```js
import round from 'round'
console.log(round(12.5, 0)) // 13
console.log(round(14.5, 1)) // 14.5
console.log(round('robin')) // 0
```
## License
Copyright (c) 2015 Todd Kennedy, [Apache 2.0](LICENSE)