From fa18174ee25ff6cceba451617130311188065bd9 Mon Sep 17 00:00:00 2001 From: Slayer95 Date: Fri, 4 Jul 2025 16:09:40 -0500 Subject: [PATCH 1/3] doc: "if and only if" should be "if" in util.parseArgs default value The default value is legal by means other than defaulting. --- doc/api/util.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/util.md b/doc/api/util.md index 6099f6a7b8d59a..d8f38e9cdfbefa 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -1956,7 +1956,7 @@ changes: `false`, values for the option are last-wins. **Default:** `false`. * `short` {string} A single character alias for the option. * `default` {string | boolean | string\[] | boolean\[]} The default value to - be used if (and only if) the option does not appear in the arguments to be + be used if the option does not appear in the arguments to be parsed. It must be of the same type as the `type` property. When `multiple` is `true`, it must be an array. * `strict` {boolean} Should an error be thrown when unknown arguments From 00e31c5db5665a85ab74260d2b2ca82defbad151 Mon Sep 17 00:00:00 2001 From: Slayer95 Date: Mon, 14 Jul 2025 17:42:00 -0500 Subject: [PATCH 2/3] doc: extend explanation of `default` in util.parseArgs --- doc/api/util.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/api/util.md b/doc/api/util.md index d8f38e9cdfbefa..836b59ef8eadf3 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -1955,10 +1955,12 @@ changes: times. If `true`, all values will be collected in an array. If `false`, values for the option are last-wins. **Default:** `false`. * `short` {string} A single character alias for the option. - * `default` {string | boolean | string\[] | boolean\[]} The default value to - be used if the option does not appear in the arguments to be - parsed. It must be of the same type as the `type` property. When `multiple` - is `true`, it must be an array. + * `default` {string | boolean | string\[] | boolean\[]} The value to assign to + the option if it does not appear in the arguments to be parsed. The value + must match the type specified by the `type` property. If `multiple` is + `true`, it must be an array. No default value is applied when the option + does appear in the arguments to be parsed, even if the provided value + is falsey. * `strict` {boolean} Should an error be thrown when unknown arguments are encountered, or when arguments are passed that do not match the `type` configured in `options`. From 087f8c0ab0e380d660105994948c522226362250 Mon Sep 17 00:00:00 2001 From: Slayer95 Date: Mon, 14 Jul 2025 18:10:22 -0500 Subject: [PATCH 3/3] Prefer "falsy" over "falsey" Co-authored-by: Jordan Harband --- doc/api/util.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/util.md b/doc/api/util.md index 836b59ef8eadf3..e34b88b4a4fd1b 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -1960,7 +1960,7 @@ changes: must match the type specified by the `type` property. If `multiple` is `true`, it must be an array. No default value is applied when the option does appear in the arguments to be parsed, even if the provided value - is falsey. + is falsy. * `strict` {boolean} Should an error be thrown when unknown arguments are encountered, or when arguments are passed that do not match the `type` configured in `options`.