Skip to content

Propose stop storing explicit undefined in values for flags #55

Closed
@shadowspawn

Description

@shadowspawn

I have touched on this in a few different issues. Opening a separate issue to make this visible and separately identified as a suggestion (and discussion). Note: I used the proposed behaviour in all the examples in #38.

I do not think storing an explicit undefined in values when flags are parsed is adding any value (pun intended).

const { parseArgs } = require('@pkgjs/parseargs');
const parsed = parseArgs(['--foo']);
console.log(parsed);

Current behaviour:

{ flags: { foo: true }, values: { foo: undefined }, positionals: [] }

Proposed behaviour:

{ flags: { foo: true }, values: {}, positionals: [] }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions