Question

I notice that Node defines both process.argv and process.ARGV (capitalized). The later isn't mentioned in the documentation and is, in every case I've encountered so far, the same object.

Is ARGV just a historic holdover, or does it have a purpose?

Was it helpful?

Solution

process.ARGV has been removed entirely since v0.5.10.

OTHER TIPS

They are identical:

node.cc

// process.argv
Local<Array> arguments = Array::New(argc - option_end_index + 1);
arguments->Set(Integer::New(0), String::New(argv[0]));
for (j = 1, i = option_end_index; i < argc; j++, i++) {
  Local<String> arg = String::New(argv[i]);
  arguments->Set(Integer::New(j), arg);
}
// assign it
process->Set(String::NewSymbol("ARGV"), arguments);
process->Set(String::NewSymbol("argv"), arguments);

Edit (based on further question):

There's only one person who can tell you that for sure (the author) - you might be able to find him on IRC (irc.freenode.net #node.js).

Looking through the other symbols, I'd guess that it was added for consistency - argv and env seem to be the only two that have both lower and upper case versions. However, ENV differs slightly from env. Maybe the author thought that argv and ARGV might differ in the same manner as env and ENV?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top