Namespace to object?
WORMSS opened this issue · 2 comments
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.
Hi,
I have the same problem,
could we have a simple method to convert the namespace into an object ?
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.