Package Exports
- rounding-decimal
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rounding-decimal) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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 number
const MY_DECIMAL_LENGTH = 2
// 1. string or number
const MY_VALUE = '1.293832'
rounding.up(MY_VALUE, MY_DECIMAL_LENGTH) // 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-decimalImport Module π¦
import { rounding } from 'rounding-decimal'Methods βοΈ
/* Math.round */
rounding.up(MY_VALUE, MY_DECIMAL_LENGTH)
/* Math.ceil */
rounding.ceil(MY_VALUE, MY_DECIMAL_LENGTH)
/* Math.floor */
rounding.floor(MY_VALUE, MY_DECIMAL_LENGTH)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.0to start. *** If open source, set the license toMIT. π€ - Push changes to your git repo.
npm loginnpm publish
{
"name": "unique-npm-project-name",
"version": "1.0.0",
"description": "Descripton of my application",
"main": "index.min.js",
"license": "MIT",
"keywords": ["list", "of", "searchable", "key", "words"]
}*** update package
- Push changes to your git repo
npm loginnpm versionwith new numbernpm publish
# updating version example
npm verison 1.0.1*** am i still logged in?
npm whoami