Skip to content

Commit

Permalink
More docs related to parse function
Browse files Browse the repository at this point in the history
  • Loading branch information
xxczaki committed Jan 20, 2020
1 parent 99ac865 commit 8a98677
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,19 @@ cashify.convert('€10 EUR', {to: 'GBP'});
cashify.convert('10 EUR to GBP');
```

**Note:** If you want to use full parsing, you need to pass a `string` with specific format: `<amount> <from-currency> to <to-currency>`, ex. `10 usd to pln`. The `to` keyword (case insensitive) is especially important. Used letter case doesn't matter, as cashify will automatically convert them to upper case.
Alternatively, if you just want to parse a `string` without conversion, you can use the [`parse`](#parseexpression) function, which returns an `object` with parsing results:

```js
const {parse} = require('cashify');

parse('10 EUR to GBP'); //=> {amount: 10, from: 'EUR', to: 'GBP'}
```

**Note:** If you want to use full parsing, you need to pass a `string` with specific format:

`<amount> <from-currency> to <to-currency>`, ex. `10 usd to pln`.

The `to` keyword (case insensitive) is especially important. Used letter case doesn't matter, as cashify will automatically convert them to upper case.

<a id="integration"></a>

Expand Down

0 comments on commit 8a98677

Please sign in to comment.