Repository: yargs/yargs-parser
Pull request #194 (2019-08-11 15:03:02)

Typo fixes.


Patch:
diff --git a/README.md b/README.md
index dde9f84..95d70b9 100644
--- a/README.md
+++ b/README.md
@@ -370,7 +370,7 @@ node example.js --test-field 1
 * key: `strip-dashed`
 
 Should dashed keys be removed before returning results?  This option has no effect if
-`camel-case-exansion` is disabled.
+`camel-case-expansion` is disabled.
 
 _If disabled:_
 
diff --git a/index.js b/index.js
index 79d433c..cf7872c 100644
--- a/index.js
+++ b/index.js
@@ -166,7 +166,7 @@ function parse (args, opts) {
       key = arg.match(negatedBoolean)[1]
       setArg(key, checkAllAliases(key, flags.arrays) ? [false] : false)
 
-    // -- seperated by space.
+    // -- separated by space.
     } else if (arg.match(/^--.+/) || (
       !configuration['short-option-groups'] && arg.match(/^-[^-]+/)
     )) {
@@ -196,12 +196,12 @@ function parse (args, opts) {
         }
       }
 
-    // dot-notation flag seperated by '='.
+    // dot-notation flag separated by '='.
     } else if (arg.match(/^-.\..+=/)) {
       m = arg.match(/^-([^=]+)=([\s\S]*)$/)
       setArg(m[1], m[2])
 
-    // dot-notation flag seperated by space.
+    // dot-notation flag separated by space.
     } else if (arg.match(/^-.\..+/)) {
       next = args[i + 1]
       key = arg.match(/^-(.\..+)/)[1]
@@ -555,7 +555,7 @@ function parse (args, opts) {
       } else {
         // setting arguments via CLI takes precedence over
         // values within the config file.
-        if (!hasKey(argv, fullKey.split('.')) || (flags.arrays[fullKey] && configuration['combine-arrays'])) {
+        if (!hasKey(argv, fullKey.split('.')) || (checkAllAliases(fullKey, flags.arrays) && configuration['combine-arrays'])) {
           setArg(fullKey, value)
         }
       }


Test patch:
diff --git a/test/tokenize-arg-string.js b/test/tokenize-arg-string.js
index 6795e1d..8575de6 100644
--- a/test/tokenize-arg-string.js
+++ b/test/tokenize-arg-string.js
@@ -52,7 +52,7 @@ describe('TokenizeArgString', function () {
     args[2].should.equal('--bar=""')
   })
 
-  it('handles quoted string with embeded quotes', function () {
+  it('handles quoted string with embedded quotes', function () {
     var args = tokenizeArgString('--foo "hello \'world\'" --bar=\'foo "bar"\'')
     args[0].should.equal('--foo')
     args[1].should.equal('"hello \'world\'"')
diff --git a/test/yargs-parser.js b/test/yargs-parser.js
index 65d90e4..cb1342c 100644
--- a/test/yargs-parser.js
+++ b/test/yargs-parser.js
@@ -83,7 +83,7 @@ describe('yargs-parser', function () {
     parse.should.have.property('_').with.length(0)
   })
 
-  it('should explicitly set a boolean option to false if preceeded by "--no-"', function () {
+  it('should explicitly set a boolean option to false if preceded by "--no-"', function () {
     var parse = parser(['--no-moo'])
     parse.should.have.property('moo', false)
     parse.should.have.property('_').with.length(0)
@@ -774,6 +774,21 @@ describe('yargs-parser', function () {
       argv.should.have.property('foo', 'bar')
       argv.should.have.property('bar', 'baz')
     })
+
+    it('should combine array typed options with alias and camel-case', function () {
+      var argv = parser(['--camEl', 'foo', '--camEl', 'bar', '-a', 'red'], {
+        array: ['cam-el', 'apple'],
+        alias: { apple: 'a' },
+        configObjects: [{ camEl: 'baz' }, { a: 'sweet' }],
+        configuration: {
+          'combine-arrays': true,
+          'camel-case-expansion': true
+        }
+      })
+
+      argv['cam-el'].should.deep.equal(['foo', 'bar', 'baz'])
+      argv.apple.should.deep.equal(['red', 'sweet'])
+    })
   })
 
   describe('dot notation', function () {
@@ -879,12 +894,12 @@ describe('yargs-parser', function () {
       argv.foo.bar.cool.should.eql(11)
     })
 
-    it("should allow flags to use dot notation, when seperated by '='", function () {
+    it("should allow flags to use dot notation, when separated by '='", function () {
       var argv = parser(['-f.foo=99'])
       argv.f.foo.should.eql(99)
     })
 
-    it("should allow flags to use dot notation, when seperated by ' '", function () {
+    it("should allow flags to use dot notation, when separated by ' '", function () {
       var argv = parser(['-f.foo', '99'])
       argv.f.foo.should.eql(99)
     })