2023.11.1-3.3 • Published 2 years ago
xtfz v2023.11.1-3.3
NPM @ XTFZ
A multipurpose package and wrapper for XTFZ and you.
Configuration
To install the package run:
npm install xtfz
Import:
const XTFZ = require("xtfz");
Start Using!
We have numerous classes and functions: Calculator, ... (soon)
Calculator
const json = true; // do you want the response in JSON?
const calculator = new XTFZ.Calculator(json);
const result = calculator.evaluate("fact(2) * /*ignore*/ fact(2) / pow(fact(2), 2)");
console.log(result); // "1"
Features:
Functions:
evaluate(expression)
- evaluate the stringrad(degrees)
- degrees to radiansdeg(radians)
- radians to degreespow(x, y)
-x
to the powery
root(x, y)
-x
rooty
log(x, y)
- logx
basey
ln(x)
- natural logx
fact(x)
-x
factorial (x!
)
Comments
- You can add comments in the
evaluate(expression)
function'sexpression
string parameter. - It must be a single line comment:
/* like this */
- This can be used to document your expression
- It works because it uses the javascript
eval()
method to evaluate. However, non-arithmetic tasks won't work.
Scientific
- We have other functions too, like trigonometric functions -
sin()
cos()
tan()
. - Note: Trigonometric functions only work in the
expression
parameter ofevaluate(expression)
function.
Made with 🍆 by @snehasishkun for XTFZ and You. 🛐
2023.11.1-3.3
2 years ago
1.0.0
2 years ago
2023.11.1-3.2
2 years ago
2023.11.1-3.1
2 years ago
2023.3.1-8.3
2 years ago
2023.3.1-8.2
2 years ago
2023.3.18
2 years ago