1.0.4 • Published 4 years ago
pharma-calculator v1.0.4
#Pharma calculator
This is a script that calculates how long a certain amount of medicine lasts depending on the dose.
#####Constructor parameters:
Dose (number)
Amount of medicine (number)
Start date (miliseconds)
##First steps
####Install it
npm i pharma-calculator
####Check package.json
- If the installation was successful, in the package.json you should see the new line in the dependencies section. The version might not be the same as the screenshot.
"dependencies": {
"pharma-calculator": "^1.0.0"
}
####Usage
First of all you have to import the library. (line 1 following screenshot)
After that you can create he Calculator object passing all constructor parameters.
const Calculator = require('pharma-calculator');
let calc = new Calculator(1, 1, new Date().getTime());
let response = calc.publicFunction();
- Finally, the Calculator class has only 1 public function. It function always return an object like the following screenshot.
Response { success: true, type: 0, data: 1586447555579 }
####Response
The response has 3 parts:
- success : true/false
- type: 1-7
- data: data returned
####Error control
- Is not allowed the empty constructor parameters. There are some responses if parameters are empty.