Skip to content

Commit

Permalink
docs(readme): update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sudkumar committed Apr 16, 2021
1 parent 2d2965c commit 31069a7
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,26 @@ npm install --save eval-num-expr

## Usage

```
import evalExpr from "eval-num-expr"
```js
import evalExpr from "eval-num-expr";

const value = evalExpr('100 + 3 * 55 + 73 - 73 * 18%')
const value = evalExpr("100 + 3 * 55 + 73 - 73 * 18%");
// value = 324.86
```

You can use basic operations (e.g. +, -, \*, /, %, ^ etc.) in you expressions.

### Examples

- 175 + 175 \* 18% + 40 = 246.5
- 10 + (100 - 100 \* 18%) \* 5 + 40 / 20 = 422

## Api

### evalExpr

This is the default and only from this package.

```js
evalExpr(expressions: string, digitsAfterDecimal?: number = 2)
```

0 comments on commit 31069a7

Please sign in to comment.