@reskit/math-expression
TypeScript icon, indicating that this package has built-in type declarations

1.3.1 • Public • Published

Install

Install @reskit/math-expression by pnpm

pnpm add @reskit/math-expression

Functions

You should import method:

import { extractMathExpression, computeMathExpression } from "@reskit/math-expression";

Extract Math Expression

Input

extractMathExpression("Calculate 1+3+4-5");

Output

["1+3+4-5"]

You can compute it by @reskit/shared

Input

import { calculate } from "@reskit/shared";

calculate("1+3+4-5");

Output

3

Compute Math Expression

computeMathExpression("Answer: 1+ 3+(4-5)*6/ 3");

Output

Answer: 2

Compute Decimal

Input

computeMathExpression("Answer: 65+28.6+35+71.4");

Output

Answer: 200

Multiple Math Expression

Input

computeMathExpression("Answer: A = 65+28.6+(1 + 35/7)+71.4; B = 1.1+1.2+1.3+1.4");

Output

Answer: A = 200; B = 5

Others

Welcome to create PR and make @reskit/math-expression better!

Package Sidebar

Install

npm i @reskit/math-expression

Weekly Downloads

2

Version

1.3.1

License

Apache-2.0

Unpacked Size

4.26 kB

Total Files

6

Last publish

Collaborators

  • simumn