Skip to content

Commit

Permalink
allow string values to be passed
Browse files Browse the repository at this point in the history
  • Loading branch information
panoply committed Sep 9, 2021
1 parent 3aa4e53 commit 1317d89
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 23 deletions.
8 changes: 6 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

### 1.1.1 - 09/09/2021

Allow `string` type to be passed as parameter value to function and replaced development rollup dependencies to use [@brixtol/rollup-config](https://github.com/BRIXTOL/rollup-config)

### 1.1.0 - 23/08/2021

Mostly development workspace adjustments. The module now exposes the mapping object on the export in addition to the matching function export.
Expand All @@ -26,9 +30,9 @@ First major version, ships with a breaking change. The default export is no long
#### Named export

```js
import { getCurrency } from "@brixtol/currencies";
import { getCurrency } from '@brixtol/currencies';

const currency = getCurrency("SE"); // SEK
const currency = getCurrency('SE'); // SEK
```

#### Breakdown
Expand Down
13 changes: 4 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@brixtol/currency-codes",
"version": "1.1.0",
"version": "1.1.1",
"description": "Mappings for 2 letter (Alpha 2) country codes to 3 letter currency code.",
"author": {
"name": "Νίκος Σαβίδης ",
Expand Down Expand Up @@ -29,9 +29,9 @@
"bugs": {
"url": "https://github.com/brixtol/currency-codes"
},
"node": {},
"engines": {
"pnpm": ">=5"
"pnpm": ">=6",
"node": ">=14"
},
"scripts": {
"dev": "rollup -c -w",
Expand All @@ -56,14 +56,9 @@
"devDependencies": {
"@brixtol/eslint-config": "^1.0.1",
"@brixtol/prettier-config": "^1.0.3",
"@brixtol/rollup-utils": "^0.2.0",
"@brixtol/rollup-config": "workspace:^1.2.0",
"@brixtol/tsconfig": "^1.0.0",
"@rollup/plugin-commonjs": "^20.0.0",
"esm": "^3.2.25",
"rollup": "^2.56.2",
"rollup-plugin-filesize": "^9.1.1",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.30.0",
"typescript": "^4.3.5"
}
}
17 changes: 6 additions & 11 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { config, env } from '@brixtol/rollup-utils';
import { defineConfig as Rollup } from 'rollup';
import { terser } from 'rollup-plugin-terser';
import commonjs from '@rollup/plugin-commonjs';
import filesize from 'rollup-plugin-filesize';
import ts from 'rollup-plugin-typescript2';
import { config, env, rollup, plugin } from '@brixtol/rollup-config';
import typescript from 'typescript';

export default Rollup(
export default rollup(
{
input: 'src/index.ts',
output: [
Expand All @@ -26,13 +21,13 @@ export default Rollup(
],
plugins: env.if('dev')(
[
ts({ useTsconfigDeclarationDir: true, typescript }),
commonjs()
plugin.ts({ useTsconfigDeclarationDir: true, typescript }),
plugin.commonjs()
]
)(
[
terser({ ecma: 2016, compress: { passes: 5 } }),
filesize()
plugin.terser({ ecma: 2016, compress: { passes: 5 } }),
plugin.filesize()
]
)
}
Expand Down
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -750,4 +750,6 @@ export const Currencies: ICurrencies = Object.freeze({
*
* _Accepts either uppercase or lowercase_
*/
export const getCurrency = (code: keyof ICurrencies): string => Currencies[code.toUpperCase()];
export const getCurrency = (
code: keyof ICurrencies | string
): string => Currencies[code.toUpperCase()];

0 comments on commit 1317d89

Please sign in to comment.