Answer the question
In order to leave comments, you need to log in
Need to split and assign variables given on the command line?
Query example:
I found out that process.argv stores all options given on the command line. But I can't figure out how to take values from process.argv and assign them to DIR and PATTERN.
Also, according to the task, the order of the parameters can be different. node index.js --DIR="/Downloads" --PATTERN=\.js
Answer the question
In order to leave comments, you need to log in
https://www.npmjs.com/package/minimist or https://www.npmjs.com/package/yargs
What's the problem anyway? We go around the process.argv array starting from the second element, and see what lies there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question