pkgjs / parseargs

Polyfill of `util.parseArgs()`
Apache License 2.0
122 stars 10 forks source link

feat: use Map rather than Object for internal result properties #57

Closed shadowspawn closed 2 years ago

shadowspawn commented 2 years ago

This came out of discussion around potential for prototype pollution. Use a Map rather than Object internally. Convert to Object for returning to client.

See https://github.com/pkgjs/parseargs/issues/32#issuecomment-1013948553

(Why not use Set for flags? Could, but a little easier to convert from Map to Object!)

shadowspawn commented 2 years ago

Thanks for feedback. I'll start again rather than leave this open, as it may be a couple of weeks before I have time.