Package Exports
- @wezom/toolkit-math
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 (@wezom/toolkit-math) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@wezom/toolkit-math
Useful math tools
Statements | Branches | Functions | Lines |
---|---|---|---|
Table of Content:
Usage
ESNext distribution version
We use TypeScript as main development language and distribute our lib in the maximum compliance with modern JavaScript specifications.
Your project bundler (webpack or something else) should not exclude this installed package from node_modules
folder for the transpilation process.
The package babel-loader-exclude-node-modules-except
can help you with this
CommonJS distribution version
If you cannot change your bundler config or if you do not want to include ESNext code version into your project - for this we have compiled CommonJS distribution version.
You can install @wezom/toolkit-math-cjs
instead of the current package.
Install the chosen npm package
# esnext version
npm i @wezom/toolkit-math
# or commonjs
npm i @wezom/toolkit-math-cjs
Tools
mathRound()
Correction of rounding of decimal fractions.
Parameters:
Name | Data type | Argument | Default value | Description |
---|---|---|---|---|
value | number |
some value | ||
exp | number |
optional |
Returns: number
mathSum()
Calculates the sum of all arguments
Parameters:
Name | Data type | Argument | Default value | Description |
---|---|---|---|---|
numbers | ...number[] |
Returns: number
Examples:
mathSum(1, 3, 5); // => 9
mathSum(1.01, 1.02); // => 2.03
Contributing
Please fill free to create issues or send PR