A simple and small library to parse your formula and provide output
Arithmetic expression to value
A javascript based library
This is a fully flexible formula parser based on Node
Table of Contents
- Features
- 🤲 Want to Motivate?
- When do you need it
- Usage
- Highlight 🔥
- Available Operators
- Items in queue
- Contribution 🍰
- License
- Node based
- Simple Javascript methods
- Carefully evaluated priorities
- Appropriate infix/prefix/postfix operations
Who doesn't need motivation? Please give the project a star(⭐) and/or share it in your dev circle.
- Has got complex formula needs to be evaluated?
npm install formula-parser
or
yarn add formula-parser
import {parseFormula} from 'array-initializer'
// const value = ('Your complex formula');
const value = ('(4*(6)^2)+(2*(123))+243/sin(80)');
It was frustrating for me when I was looking for some easy way to evaluate complex formulae in various part of my application.
Operator | Description | Positioning |
---|---|---|
+ | Addition | prefix |
- | Subtraction | prefix |
+ | Multiplication | prefix |
/ | Division | prefix |
( | Bracket open | prefix |
) | Bracket close | postfix |
, | Coma | infix |
^ | Power | infix |
! | Factorial | postfix |
abs | Absolute | function |
min | Minimum | function |
sqrt | Square root | function |
sin | Sin function | prefix |
cos | Cos function | prefix |
- Logically endless combinations
If you understand the importance please feel free to create issue and make pull request
Refer code of conduct
Refer contributing
MIT © Koustov