christians-first-node-module
v1.0.2
Published
very first module
Downloads
4
Readme
christians-first-node-module
Christian's First Node Module is a test package that I created in order to learn how NPM worked.
How to install it.
- Let's start with creating an npm project.
npm init
Create the project hitting enter after filling everything out.
Install the project.
npm install christians-first-node-module
How to start using it
This package has some basic functions which you can use right off when you install it.
- Create a file called
index.js
- Inside the file
index.js
add the following code to get the functions inside of the package:
const {getArea, getSum, getDifference} = require('christians-first-node-module');
- Add the rest of the code in order to log the results.
const {getArea, getSum, getDifference} = require('christians-first-node-module');
// log the area of a square. You can change the numbers.
console.log(getArea(4, 4))
// log the area of a square. You can change the numbers.
console.log(getArea(4, 4))
// log the sum of two numbers. You can change the numbers.
console.log(getSum(1, 4))
// log the difference of two numbers. You can change the numbers.
console.log(getSum(10, 4))
Functions
|Function | Description |
|-----------|----------|
|getArea(width, height)
| Gets the Area of a square.|
|getSum(num1, num2)
| Gets the sum between two numbers.|
|getDifference(num1, num2)
| Gets the difference between two numbers.|
More functions will be added with time.