Skip to content

Commit 8a98677

Browse files
committed
More docs related to parse function
1 parent 99ac865 commit 8a98677

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

readme.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,19 @@ cashify.convert('€10 EUR', {to: 'GBP'});
120120
cashify.convert('10 EUR to GBP');
121121
```
122122

123-
**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.
123+
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:
124+
125+
```js
126+
const {parse} = require('cashify');
127+
128+
parse('10 EUR to GBP'); //=> {amount: 10, from: 'EUR', to: 'GBP'}
129+
```
130+
131+
**Note:** If you want to use full parsing, you need to pass a `string` with specific format:
132+
133+
`<amount> <from-currency> to <to-currency>`, ex. `10 usd to pln`.
134+
135+
The `to` keyword (case insensitive) is especially important. Used letter case doesn't matter, as cashify will automatically convert them to upper case.
124136

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

0 commit comments

Comments
 (0)