Skip to content

Commit df705f8

Browse files
committed
fix formatting and add a missing "let" keyword
1 parent 0cce777 commit df705f8

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

index.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ function parse (args, opts) {
227227
next = args[i + 1]
228228
key = arg.match(/^-(.\..+)/)[1]
229229

230-
if(!configuration['ignore-unknown-options'] || hasAnyFlag(key)) {
230+
if (!configuration['ignore-unknown-options'] || hasAnyFlag(key)) {
231231
if (next !== undefined && !next.match(/^-/) &&
232232
!checkAllAliases(key, flags.bools) &&
233233
!checkAllAliases(key, flags.counts)) {
@@ -242,7 +242,7 @@ function parse (args, opts) {
242242
} else if (arg.match(/^-[^-]+/) && !arg.match(negative)) {
243243
letters = arg.slice(1, -1).split('')
244244
broken = false
245-
unmatched = []
245+
let unmatched = []
246246

247247
for (var j = 0; j < letters.length; j++) {
248248
next = arg.slice(j + 2)
@@ -262,9 +262,9 @@ function parse (args, opts) {
262262
} else if (!configuration['ignore-unknown-options'] || hasAnyFlag(key)) {
263263
setArg(key, value)
264264
} else {
265-
unmatched.push(key);
266-
unmatched.push('=');
267-
unmatched.push(value);
265+
unmatched.push(key)
266+
unmatched.push('=')
267+
unmatched.push(value)
268268
}
269269

270270
broken = true
@@ -275,8 +275,8 @@ function parse (args, opts) {
275275
if (!configuration['ignore-unknown-options'] || hasAnyFlag(letters[j])) {
276276
setArg(letters[j], next)
277277
} else {
278-
unmatched.push(letters[j]);
279-
unmatched.push(next);
278+
unmatched.push(letters[j])
279+
unmatched.push(next)
280280
}
281281
continue
282282
}
@@ -287,8 +287,8 @@ function parse (args, opts) {
287287
if (!configuration['ignore-unknown-options'] || hasAnyFlag(letters[j])) {
288288
setArg(letters[j], next)
289289
} else {
290-
unmatched.push(letters[j]);
291-
unmatched.push(next);
290+
unmatched.push(letters[j])
291+
unmatched.push(next)
292292
}
293293
broken = true
294294
break
@@ -298,8 +298,8 @@ function parse (args, opts) {
298298
if (!configuration['ignore-unknown-options'] || hasAnyFlag(letters[j])) {
299299
setArg(letters[j], next)
300300
} else {
301-
unmatched.push(letters[j]);
302-
unmatched.push(next);
301+
unmatched.push(letters[j])
302+
unmatched.push(next)
303303
}
304304
broken = true
305305
break
@@ -335,7 +335,7 @@ function parse (args, opts) {
335335
setArg(key, defaultValue(key))
336336
}
337337
} else {
338-
unmatched.push(key);
338+
unmatched.push(key)
339339
}
340340
}
341341
if (unmatched.length > 0) {
@@ -805,7 +805,7 @@ function parse (args, opts) {
805805

806806
return isSet
807807
}
808-
808+
809809
function hasAnyFlag (key) {
810810
var isSet = false
811811
var toCheck = [].concat(Object.values(flags))

test/yargs-parser.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3040,7 +3040,7 @@ describe('yargs-parser', function () {
30403040
})
30413041
argv.should.deep.equal({
30423042
_: ['-u=2'],
3043-
'k': 1
3043+
'k': 1
30443044
})
30453045
})
30463046
it('should ignore unknown options in short format followed by hyphen', function () {
@@ -3052,7 +3052,7 @@ describe('yargs-parser', function () {
30523052
})
30533053
argv.should.deep.equal({
30543054
_: ['-u-'],
3055-
'k': '-'
3055+
'k': '-'
30563056
})
30573057
})
30583058
it('should ignore unknown options in short format separated by space', function () {
@@ -3064,7 +3064,7 @@ describe('yargs-parser', function () {
30643064
})
30653065
argv.should.deep.equal({
30663066
_: ['-u', 2],
3067-
'k': 1
3067+
'k': 1
30683068
})
30693069
})
30703070
it('should ignore unknown options in short format followed by a number', function () {
@@ -3076,7 +3076,7 @@ describe('yargs-parser', function () {
30763076
})
30773077
argv.should.deep.equal({
30783078
_: ['-u2'],
3079-
'k': 1
3079+
'k': 1
30803080
})
30813081
})
30823082
it('should ignore unknown options in short format followed by a non-word character', function () {
@@ -3088,7 +3088,7 @@ describe('yargs-parser', function () {
30883088
})
30893089
argv.should.deep.equal({
30903090
_: ['-u/2/'],
3091-
'k': '/1/'
3091+
'k': '/1/'
30923092
})
30933093
})
30943094
})
@@ -3101,7 +3101,7 @@ describe('yargs-parser', function () {
31013101
})
31023102
argv.should.deep.equal({
31033103
_: ['-u'],
3104-
'k': true,
3104+
'k': true,
31053105
'v': true
31063106
})
31073107
it('should ignore unknown options in short format with multiple flags in one argument where an unknown flag is at the end', function () {
@@ -3113,7 +3113,7 @@ describe('yargs-parser', function () {
31133113
})
31143114
argv.should.deep.equal({
31153115
_: ['-u'],
3116-
'k': true,
3116+
'k': true,
31173117
'v': true
31183118
})
31193119
})

0 commit comments

Comments
 (0)