diff --git a/package.json b/package.json index d6dfd2c..1d4dabb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "arge", - "version": "1.1.2", + "version": "1.1.3", "description": "A simple utility to parse command line arguments and flags", "keywords": [ "argv", diff --git a/src/__tests__/index.test.ts b/src/__tests__/index.test.ts index 8bb901a..fab40cb 100644 --- a/src/__tests__/index.test.ts +++ b/src/__tests__/index.test.ts @@ -25,11 +25,11 @@ describe('arge', () => { it('trims spaces between keys and values', () => { const argv = [ ...baseArgs, - '-f ', - '--dry-run ', - '--mode = development', - '--test = false', - '--retries = 100', + ' -f ', + ' --dry-run ', + ' --mode = development', + ' --test = false', + ' --retries = 100', ] expect(arge(argv)).toEqual({ diff --git a/src/index.ts b/src/index.ts index 1b03df2..62e3c41 100644 --- a/src/index.ts +++ b/src/index.ts @@ -41,7 +41,7 @@ export const arge = ( : args ).reduce((acc, curr) => { const [k, v = 'true'] = curr.split('=') - let key = k.replace(/^-+/, '') + let key = k.trim().replace(/^-+/, '') key = options.camelCaseKeys ? key.replace(/-([a-z])/g, g => g[1].toUpperCase())