diff --git a/index.js b/index.js index 917189a9..69fa72dc 100644 --- a/index.js +++ b/index.js @@ -180,12 +180,12 @@ function parse (args, opts) { )) { key = arg.match(/^--?(.+)/)[1] - // array format = '--foo a b c' - if (checkAllAliases(key, flags.arrays) && args.length > i + 1) { - i = eatArray(i, key, args) // nargs format = '--foo a b c' - } else if (checkAllAliases(key, flags.nargs)) { + if (checkAllAliases(key, flags.nargs)) { i = eatNargs(i, key, args) + // array format = '--foo a b c' + } else if (checkAllAliases(key, flags.arrays) && args.length > i + 1) { + i = eatArray(i, key, args) } else { next = args[i + 1] diff --git a/test/yargs-parser.js b/test/yargs-parser.js index a1d17de2..81dff196 100644 --- a/test/yargs-parser.js +++ b/test/yargs-parser.js @@ -1774,17 +1774,6 @@ describe('yargs-parser', function () { result.foo.should.eql('a') }) - - it('should be ignored if input is an array', function () { - var result = parser(['--foo', 'a', 'b'], { - array: 'foo', - narg: { - foo: 1 - } - }) - - result.foo.should.eql(['a', 'b']) - }) }) describe('env vars', function () {