0.0.1 • Published 7 years ago
dv4all-hello-calc-test v0.0.1
Hello calc test module
This is simple test module that handles 4 basic math functions.
Installation
# long version
npm install save dv4all-hello-calc-test
# short version
npm i -s dv4all-hello-calc-test
How to use
- To add 2 numbers call add2Numbers function.
import calc from 'dv4all-hello-calc-test'
let sum = calc.add2Numbers(1,2);
- To substract second number from first one
import calc from 'dv4all-hello-calc-test'
let sub = calc.add2Numbers(3,2);
How to publish npm package
First create module/app.
- login to your npm account
npm login <account>
- create package json file
npm init
- create module/app: in this example only index.js file exist
module.exports = {
/**
* Add two numbers
* @param {number} x, first number
* @param {number} y, second number
*/
add2Numbers: (x,y) => {
return x + y;
},
/**
* Substract second number from firstone
* @param {number} x, first number
* @param {number} y, second number
*/
sub2Numbers: (x,y) => {
return x - y;
},
/**
* Multiply two numbers
* @param {number} x, first number
* @param {number} y, second number
*/
mp2Numbers: (x,y) => {
return x * y;
},
/**
* Divide two numbers
* @param {number} x, first number
* @param {number} y, second number
*/
div2Numbers: (x,y) => {
return x / y;
}
};
- publish to npm
npm publish
0.0.1
7 years ago