Skip to content

Commit

Permalink
add new method and add new test
Browse files Browse the repository at this point in the history
  • Loading branch information
techsoft705 committed Dec 5, 2020
1 parent 784ff13 commit 410c987
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app-dev/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// init module
const mathoperation = require('node-math-operation')
const nodeMath = require('node-math-operation')
// init method
const output = mathoperation.multiplication(20, 40)
const output = nodeMath.greaterThan(20, 40)
// tampilkan output
console.log(output)
3 changes: 2 additions & 1 deletion app-dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
},
"keywords": [],
"author": "restuwahyu13",
"license": "MIT"
"license": "MIT",
"dependencies": {}
}
26 changes: 24 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @description MathFundamental adalah utility untuk melakukan perhitungan matematika dasar
*/
declare namespace mathoperation {
declare namespace nodeMath {

// membuat fungsi interface untuk masing - masing method function

Expand Down Expand Up @@ -29,6 +29,16 @@ declare namespace mathoperation {
subtraction: () => :number
}

interface MathGreatherThan {
greaterThan: () => :boolean
}


interface MathLessThan {
lessThan: () => :boolean
}


/**
* @params { x: number, y: number }
* @params y: number
Expand Down Expand Up @@ -70,6 +80,18 @@ declare namespace mathoperation {
* @return number
*/
function subtraction(x: number, y: number): MathSubtraction {}
/**
* @params { x: number, y: number }
* @description untuk komparasi angka lebih nesar
* @return boolean
*/
function greaterThan(x: number, y: number): MathGreatherThan {}
/**
* @params { x: number, y: number }
* @description untuk komparasi angka lebih kecil
* @return boolean
*/
function lessThan(x: number, y: number): MathLessThan {}
}
// export module type defination
export = mathoperation
export = nodeMath
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ const { exponentiation } = require('./src/libs/exponentiation')
const { modulus } = require('./src/libs/modulus')
const { multiplication } = require('./src/libs/multiplication')
const { subtraction } = require('./src/libs/subtraction')
const { greaterThan } = require('./src/libs/greaterThan')
const { lessThan } = require('./src/libs/lessThan')

module.exports = { addition, division, exponentiation, modulus, multiplication, subtraction }
module.exports = { addition, division, exponentiation, modulus, multiplication, subtraction, greaterThan, lessThan }
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "node-math-operation",
"name": "node-math",
"version": "0.0.2",
"description": "math operation is basic operation for calculation number",
"description": "node-math is basic operation for calculation number",
"main": "index.js",
"scripts": {
"test": "jest",
Expand Down

0 comments on commit 410c987

Please sign in to comment.