Before you use any frameworks, you should know the fundamentals of what makes Node CLI's tick. Here we explain everything you need to know to write a complete Node.js CLI from scratch, parse arguments, publish it to NPM for users, and set up yarn symlinks for optimal developer experience.
what is your zsh theme??
I was wondering when i came across this line: args[1].slice("--name=")[1] For me this does not work as expected. Is there some hidden magic i am missing, since as far as i know slice expects an startIndex as number?
If I change the code to:
const nameOption = '--name='; const name = args[1].slice(nameOption.length);
Than everything works as expected. Can please someone confirm or explain?
I was wondering when i came across this line: args[1].slice("--name=")[1] For me this does not work as expected. Is there some hidden magic i am missing, since as far as i know slice expects an startIndex as number?
If I change the code to:
const nameOption = '--name='; const name = args[1].slice(nameOption.length);
Than everything works as expected. Can please someone confirm or explain?
The instructor uses .split
instead of .slice
which might be where the confusion is coming from?