Skip to content

allow non string values to be passed for values#46

Closed
lee-elenbaas wants to merge 1 commit intoyargs:masterfrom
lee-elenbaas:master
Closed

allow non string values to be passed for values#46
lee-elenbaas wants to merge 1 commit intoyargs:masterfrom
lee-elenbaas:master

Conversation

@lee-elenbaas
Copy link
Copy Markdown

allows for parsing of arrays like: ['--param', 15]

@nexdrew
Copy link
Copy Markdown
Member

nexdrew commented Aug 8, 2016

Before we review this, would you mind describing the use-case(s) this will help solve apart from doing something like the following?

var parse = require('yargs-parser')
parse(['-f', 11, '--zoom', 55].join(' ')) // <-- array to single string
parse(['-f', 11, '--zoom', 55].map(String)) // <-- array of strings

EDIT: Note that I'm not opposed to this idea, but I want to make sure that:

  1. It's clear that this is a worthwhile change
  2. We implement this as robustly as possible (I think I see a few problems with your changes)

Thanks for offering this, btw! Looking forward to your thoughts and discussion.

@bcoe
Copy link
Copy Markdown
Member

bcoe commented Aug 9, 2016

@lee-elenbaas I think I'd rather keep the explicit contract that yargs-parser expects an array of strings, does @nexdrew's suggestion of:

parse(['-f', 11, '--zoom', 55].map(String))

provide a reasonable workaround for you?

@lee-elenbaas
Copy link
Copy Markdown
Author

It is the workaround i am currently using - at the very least - that contract should be documented

@nexdrew
Copy link
Copy Markdown
Member

nexdrew commented Aug 10, 2016

at the very least - that contract should be documented

@lee-elenbaas Sounds reasonable to me. Thanks for bringing this up and for your understanding in this matter!

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

Successfully merging this pull request may close these issues.

3 participants