Skip to content

remove '[Object: null prototype]' on util.parseArgs().values #44547

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
himself65 opened this issue Sep 6, 2022 · 1 comment
Closed

remove '[Object: null prototype]' on util.parseArgs().values #44547

himself65 opened this issue Sep 6, 2022 · 1 comment
Labels
util Issues and PRs related to the built-in util module.

Comments

@himself65
Copy link
Member

himself65 commented Sep 6, 2022

Version

16.17.0

Platform

Linux himself65 5.15.0-47-generic #51-Ubuntu SMP Thu Aug 11 07:51:15 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

util

What steps will reproduce the bug?

#!/usr/bin/env ts-node
import { parseArgs } from 'node:util'

const args = process.argv.slice(2)

const { values } = parseArgs({
  args,
  options: {
    projectName: {
      type: 'string'
    }
  }
})
console.log(values)
./index.ts --projectName 123

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior?

{ projectName: '123' }

What do you see instead?

[Object: null prototype] { projectName: '123' }

Additional information

No response

@himself65 himself65 added the util Issues and PRs related to the built-in util module. label Sep 6, 2022
@himself65 himself65 changed the title remove '[Object: null prototype]' on parseArgs().values remove '[Object: null prototype]' on util.parseArgs().values Sep 6, 2022
@mscdex
Copy link
Contributor

mscdex commented Sep 7, 2022

What specifically is the problem with using an object with a null prototype? console.log() inspects its argument to display a human-readable/formatted description of its argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
util Issues and PRs related to the built-in util module.
Projects
None yet
Development

No branches or pull requests

2 participants