Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/koustov/formula-parser
https://github.com/koustov/formula-parser
Last synced: 11 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/koustov/formula-parser
- Owner: koustov
- Created: 2021-11-02T10:05:42.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-11-06T05:22:41.000Z (about 3 years ago)
- Last Synced: 2024-11-12T16:49:08.455Z (2 months ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
formula-parser
A simple and small library to parse your formula and provide output
Arithmetic expression to value
A javascript based library
---
![GitHub watchers](https://img.shields.io/github/watchers/koustov/formula-parser.svg?logo=github&label=Watch) ![GitHub watchers](https://img.shields.io/github/issues/koustov/formula-parser?logo=github&label=Issues) ![GitHub watchers](https://img.shields.io/github/stars/koustov/formula-parser?logo=github&label=Stars) ![GitHub watchers](https://img.shields.io/npm/dt/js-formula-parser.svg?logo=npm&label=downloads)
This is a **fully flexible** formula parser based on [`Node`](https://nodejs.org/en/)
**Table of Contents**
- [Features](#features)
- [🤲 Want to Motivate?](#-want-to-motivate)
- [When do you need it](#when-do-you-need-it)
- [Install 🐙](#install-)
- [Usage](#usage)
- [Highlight 🔥](#highlight-)
- [Available Operators](#available-operators)
- [Items in queue](#items-in-queue)
- [Contribution 🍰](#contribution-)
- [License](#license)## Features
- Node based
- Simple Javascript methods
- Carefully evaluated priorities
- Appropriate infix/prefix/postfix operations## 🤲 Want to Motivate?
Who doesn't need motivation? Please give the project a star(⭐) and/or share it in your dev circle.
## When do you need it
- Has got complex formula needs to be evaluated?
### Install 🐙
```bash
npm install formula-parser
```or
```bash
yarn add formula-parser
```## Usage
```js
import {parseFormula} from 'array-initializer'// const value = ('Your complex formula');
const value = ('(4*(6)^2)+(2*(123))+243/sin(80)');
```
## Highlight 🔥It was frustrating for me when I was looking for some easy way to evaluate complex formulae in various part of my application.
## Available Operators
|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|## Items in queue
- Logically endless combinations
## Contribution 🍰
If you understand the importance please feel free to create issue and make pull request
Refer [code of conduct ](./CODE_OF_CONDUCT.md)
Refer [contributing ](./CONTRIBUTING.md)
## License
MIT © [Koustov](https://github.com/koustov)