From 1317d89047acadaf8601368788110e2e1435b69d Mon Sep 17 00:00:00 2001 From: Nikolas Savvidis Date: Thu, 9 Sep 2021 23:25:26 +0200 Subject: [PATCH] allow string values to be passed --- changelog.md | 8 ++++++-- package.json | 13 ++++--------- rollup.config.mjs | 17 ++++++----------- src/index.ts | 4 +++- 4 files changed, 19 insertions(+), 23 deletions(-) diff --git a/changelog.md b/changelog.md index debe1cd..fccac11 100644 --- a/changelog.md +++ b/changelog.md @@ -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. @@ -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 diff --git a/package.json b/package.json index f44aacf..ac5289f 100644 --- a/package.json +++ b/package.json @@ -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": "Νίκος Σαβίδης ", @@ -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", @@ -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" } } diff --git a/rollup.config.mjs b/rollup.config.mjs index 0557920..31a093a 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -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: [ @@ -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() ] ) } diff --git a/src/index.ts b/src/index.ts index 2e4b652..7ff8d20 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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()];