Precision Decimal Rounding ( Round, Ceil, & Floor)
What this package does? 🤔
Tiny package for rounding a number to a specific number of decimal places
/* example */ // 1. desired decimal in response// 2. string or numberconst MY_DECIMAL_LENGTH = 2 // 1. string or numberconst MY_VALUE = '1.293832' rounding // 1.29 🏁
Why this package? 🤔
- Can handle decimals as type string or number.
- Also compatible with Typescript files.
Results 🙋
- Pass in a decimal (number), returns a type number response.
- Pass in a decimal (string), returns a type string response..
Size 🔬
Less-than < 2 kilobytes
OK! Lets Get Started 💥
Npm or Yarn installion
npm install rounding-decimal yarn add rounding-decimal
Import Module 📦
Methods ⚙️
/* Math.round */rounding /* Math.ceil */rounding /* Math.floor */rounding
The End 🏝️
We could use your help! Please share your experience & code if you got a solution 🛠️to a unique problem 🚀. The community needs your support! ❤️
Working with npm packages
*** New package
- Setup an npm account. (if not done aleardy)
- Create a
package.json
(snippet below) at application root and set version1.0.0
to start. *** If open source, set the license toMIT
. 🤟 - Push changes to your git repo.
npm login
npm publish
*** update package
- Push changes to your git repo
npm login
npm version
with new numbernpm publish
# updating version example npm verison 1.0.1
*** am i still logged in?
npm whoami