Skip to content
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

Namespace to object? #98

Closed
WORMSS opened this issue May 19, 2016 · 2 comments
Closed

Namespace to object? #98

WORMSS opened this issue May 19, 2016 · 2 comments

Comments

@WORMSS
Copy link

WORMSS commented May 19, 2016

Is there any reason that when I console.log(parser.parseArgs()) I get Namespace { config: 'script/config1.js' };

It wouldn't normally be a problem as when I do Object.keys(parser.parseArgs()) I get [ 'config' ] which I would expect.

But when using extend and js-extend I was getting a funky "isset": [Function], "set": [Function], "get" [Function], "unset": [Function] added to the output object.

I originally throught it was extend and js-extend doing it, but once I taken parseArgs out of the equation, it cleared up.

I am not looping through Object.keys in my own extend function to bypass this, but don't know what funkiness that your module is doing to add this strange "Namespace" to the output object.

  • Colin.
@Exifers
Copy link

Exifers commented Sep 30, 2019

Hi,
I have the same problem,

could we have a simple method to convert the namespace into an object ?

@rlidwka
Copy link
Member

rlidwka commented Aug 14, 2020

Use Object.assign({}, namespace) to copy own arguments into plain object.

Namespace is ported straight from python, and I'm not sure whether it should just be a plain object. But isset and friends are gone in argparse 2.0 anyways, so closing this.

@rlidwka rlidwka closed this as completed Aug 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants