Skip to content

Commit

Permalink
Update libs, add getCurrencySymbol, update mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasbergqvist committed Apr 9, 2023
1 parent dc95506 commit 796d55e
Show file tree
Hide file tree
Showing 5 changed files with 2,047 additions and 1,824 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,5 @@
"@types/jest": "^26.0.24",
"tsdx": "^0.14.1",
"typescript": "^4.3.5"
},
"dependencies": {}
}
}
20 changes: 19 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ yarn add simple-currency-format

**Returns**: `string`, Formatted currency

## Example:
#### Example:

```javascript
import { currencyFormat } from 'simple-currency-format';
Expand All @@ -49,6 +49,24 @@ console.log(currencyFormat(1000000, 'en-US', 'USD'));
// $1, 000, 000;
```

### getCurrencySymbol(currency)

**Parameters**:

**currency**: `string`, Currency code (i.e. EUR, USD, GBP)

**Returns**: `string`, Currency symbol (i.e. kr, £)

#### Example:

```javascript
import { getCurrencySymbol } from 'simple-currency-format';
console.log(getCurrencySymbol('SEK'));
// kr;
console.log(getCurrencySymbol('GBP'));
// £;
```

## Credits

- [Intl.js](https://github.com/andyearnshaw/Intl.js/): We use currency format data from this library.
Expand Down
Loading

0 comments on commit 796d55e

Please sign in to comment.