Wednesday, 26 April 2017

Is there a way to pass regex to string option in minimist?

I need to interpret some of my commandline arguments (using minimist) as string instead of int. Minimist provides and option to pass an array of commandline arguments you wish to consider as strings.

Something like this:

var args = minimist(process.argv.slice(2), {
  "string": [ "abc-src" ] 
});

What I want to do is something like this:

var args = minimist(process.argv.slice(2), {
  "string": [ /^*-src/ ] 
});

Is there a way to do this?



via rahulg

No comments:

Post a Comment